在 Crystal Reports 中将行数据转换为列 [英] Transposing Row Data as Columns in Crystal Reports

查看:22
本文介绍了在 Crystal Reports 中将行数据转换为列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从存储过程中返回了以下数据

I have the following data returned from a stored procedure

Staff  Category   Amount
-----  -------    ------
Bob    Art        123
Bob    Sport      777
Bob    Music      342 
Jeff   Art        0
Jeff   Sport      11
Jeff   Music      27

即使金额为零,也将始终为所有员工返回所有类别

All Categories will always be returned for all Staff even is the Amount is zero

我想在我的 Crystal Report 上做的是这样输出:-

What I want to do on my Crystal Report is output this:-

Staff   Art     Sport   Music   
-----   ---     -----   -----   
Bob     123     777     342
Jeff    0       11      27

我实际上想将类别行中的数据转置为我的报告中的标题或列.

I effectively want to Transpose the data in the Category rows as headers or columns in my report.

我不想使用交叉表,因为我还有其他需要添加的东西不能很好地融入交叉表

I do not want to use a Cross Tab as I have other things I need to add which will not fit nicely into a Cross Tab

关于如何在 Crystal 中执行此操作有什么想法吗?我使用的是版本 11

Any thoughts on how I can do this in Crystal? I'm using version 11

推荐答案

按人员对报表进行分组,并将人员、艺术、体育、音乐作为文本字段放在组标题中.

Group the report by staff and place staff, Art, Sport, Music as text fields in Group header.

现在详细信息部分将数据设置为

now in details section place data as

Staff, formula 1 (If Category='Art' then Amount), formula 2 (If Category='Sport' then Amount), formula 3 (If Category='Music' then Amount)

如果 Staff 只有一个值,则可以将 Staff 放在组页脚中,并对组页脚中的所有值求和(不要从详细信息中删除公式 1、2、3)

If Staff has only one value then its ok else place Staff in Group footer and take sum of all values in group footer (Don't remove Formula 1,2,3 from details)

这篇关于在 Crystal Reports 中将行数据转换为列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆