添加“总计”在没有CrossTab的Crystal Reports中的每行和列 [英] Add "Total" per row and column in Crystal Reports without CrossTab

查看:493
本文介绍了添加“总计”在没有CrossTab的Crystal Reports中的每行和列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的问题。



假设我有一个Stored Proceudre,返回一个包含以下列的表:(Item,GreenColour,RedColour)可能的项目以及它们中有多少是绿色或红色。即,可能的输出可以是{(Apple,4,2),(Chair,1,2)}。



我想在报告中做的是



在标题部分,写入四个列:Item,Green,Red和Total;其中总计对应于每行的总计。然后在详细信息部分添加GreenColour,RedColour和一些其他TotalColours字段(我不知道很好)。



这听起来非常类似于CrossTab工具,但它不能这样做。
我知道一个可能的答案是通过添加总计列并在查询中计算它来修改StoredProcedure。并在查询后添加一个UNION的Total,其中Item是Total,Green和Sum的值是另一个查询的SUM。但我不想这样做,我想水晶报告解决它。



谢谢,我很抱歉写了这么多的问这样一个简单的问题。



编辑:我想要的输出结果为:

 项目绿色颜色红色总价
Apple 4 2 6
椅子1 2 3
总计5 4¿

也想知道是否可以使用'9'

解决方案

你说得对,交叉表是过度的。只需创建一个公式来总计颜色:



{table.GreenCount} + {table.RedCount} p>

要获取报告总数(在示例中为9),只需插入求和摘要。 (右键单击刚刚创建的公式字段 - >插入 - >摘要 - >计算此摘要为Sum)。


I have a simple question.

Suppose I have a Stored Proceudre that returns a table with the following columns: (Item, GreenColour, RedColour), corresponding to all the possible Items and how many of them are "Green" or "Red". i.e, a possible output could be {(Apple, 4, 2), (Chair, 1, 2)}.

What I want to do in the report is the following:

In the header section, write four columns: "Item", "Green", "Red" and "Total"; where "Total" corresponds to the total per row. Then in the "Details" section adding the "GreenColour", "RedColour" and some other "TotalColours" field (Which I don't know well). And also adding an additional line at the bottom with the totals per column.

This sounds very similar to the "CrossTab" tool, but it can't be done that way. I know a possible answer is modifying the StoredProcedure by adding the "Total" column and compute it in the query. And adding the "Total" per column with a UNION after the query, where "Item" is "Total" and values of "Green" and "Sum" are "SUM" of another query. But I don't want to do it this way, I want Crystal Reports to solve it.

Thanks and I apologize of writing so much for asking such a simple question.

Edit: The wanted output for my example would be:

Item      Green Colour    Red Colour    Total
Apple          4              2           6
Chair          1              2           3
Total          5              4           ¿9?

Also would like to know if it's possible to make both ways with the '9' and without it.

解决方案

You're right, crosstabs are overkill for this. Just create a formula to sum the colors:

{table.GreenCount} + {table.RedCount}

To get the report totals (the 9 in your example), just insert a summation summary. (Right-click the formula field you just created -> "Insert" -> "Summary" -> "Calculate this summary" as Sum).

这篇关于添加“总计”在没有CrossTab的Crystal Reports中的每行和列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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