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

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

问题描述

我有一个简单的问题.

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

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:

在标题部分,写四列:Item"、Green"、Red"和Total";其中Total"对应于每行的总数.然后在详细信息"部分添加GreenColour"、RedColour"和其他一些TotalColours"字段(我不太了解).并且还在底部添加了额外的一行,其中包含每列的总数.

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.

这听起来与CrossTab"工具非常相似,但不能那样做.我知道一个可能的答案是通过添加Total"列来修改 StoredProcedure 并在查询中计算它.并在查询后使用 UNION 添加每列的Total",其中Item"是Total",Green"和Sum"的值是另一个查询的SUM".但是我不想这样,我要水晶报表来解决.

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.

我的示例想要的输出是:

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?

还想知道是否可以同时使用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}

要获取报告总数(您的示例中为 9),只需插入一个汇总摘要.(右击刚刚创建的公式字段->插入"->汇总"->计算此汇总"为求和).

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天全站免登陆