Cristal Reports:如何将组摘要值放入另一个组的页脚

时间:2018-01-17 12:18:58

标签: crystal-reports

所有!

我有一个表格形式的子报表。它是建筑物中的房间列表,每个房间都有几种类型的区域(在桌子的每一行)。每个房间都有一个类型。我需要在报告中按房间类型汇总数据。但是我需要把它放在每个组之后(按房间类型),但是在表的末尾。我的报告数据也按房间号和级别编号分组。也就是说,我必须将汇总值从房间类型组页脚移动到房间号(房间类型组的父级)组页脚。 CR允许我这样做,但在报告中我只能看到第一个汇总的行。

我不能使用交叉表,因为它们无法无缝地集成到主表中。我可以使用全局变量和" WhilePrintingRecords"来获得所需的值。但同样,我如何格式化这些数据以无缝地将其附加到表中?

这个问题有解决方法吗?如果根本不能在CR中完成,请告诉我。

现在看起来像这样:

rooms of type 1  
1         areaval1     areaval2    areaval3  
2         areaval1     areaval2    areaval3  
3         areaval1     areaval2    areaval3  
Summary for type 1:  
GroupName sumval       sumval      sumval  
rooms of type 2  
4         areaval1     areaval2    areaval3  
5         areaval1     areaval2    areaval3  
Summary for type 2  
GroupName sumval       sumval      sumval  

And this is what I need:  
rooms of type 1  
1     areaval1     areaval2    areaval3  
2     areaval1     areaval2    areaval3  
3     areaval1     areaval2    areaval3  
rooms of type 2  
4     areaval1     areaval2    areaval3  
5     areaval1     areaval2    areaval3  
Summary for type 1  
GroupName sumval       sumval      sumval  
Summary for type 2  
GroupName sumval       sumval      sumval  

在实际报告中,它被格式化为一个表格,带有可见线条和所有...这就是问题 - 将移动的部分保存为表格的一部分。

3 个答案:

答案 0 :(得分:0)

是的,它绝对可以,但你需要做一些努力工作。

我相信你已经创建了房间号码组作为房间类型的父组,因此在房间号码组标题中创建一个String数组并将其指定为null,如下所示。

创建公式Initialize

Shared Stringvar array store;
store:="";

现在在group2页脚(房间类型组)中,您有组页脚的摘要数据,创建一个变量并写下面的代码:

创建公式add data

Shared Stringvar array store;

store:=store+ (CSTR(GroupName)+"-"+CSTR(sumval)+"-"+CSTR(sumval)+"-"+CSTR(sumval);

在组页脚1中,您需要提取数组以显示数据:

创建公式Extract Data

Shared Stringvar array store;

    Split(store[1],"-")[1] + "    "+Split(store[1],"-")[2] + "    "++Split(store[1],"-")[3] + "    "+Split(store[1],"-")[4] + "    "+ChrW(13)+
    Split(store[2],"-")[1] + "    "+Split(store[2],"-")[2] + "    "++Split(store[2],"-")[3] + "    "+Split(store[2],"-")[4] + "    "+ChrW(13)
//This will depend on number of sub groups, If there are more sub groups let me know will try to automate

目前我没有可以测试的工具,但这可行,实施并让我知道。

答案 1 :(得分:0)

嗯,这就是我说的时候的意思 -

  

我可以使用全局变量和" WhilePrintingRecords"来获得所需的值。但同样,我如何格式化这些数据以无缝地将其附加到表中?

是的,这会有效。但格式化呢?

This is what I need (well, the report is in Russian):

我所说的行是红色矩形 房间类型的数量是可变的。

答案 2 :(得分:0)

没有进一步的建议?我还不够清楚吗? 好吧,我试图解决修改报告数据源(XML文件)的问题。我将汇总值放入XML文件中,而不是在报告中汇总,并尝试从那里获取它们 但还有另一个问题 我已经在房间区域表中使用了子报表(除了表格之外,报表中还有很多信息,这里使用子报表是唯一的方法)。所以我不能使用另一个子报表来放入汇总表。如果把它放到组页脚,那么我仍然只能看到第一行。如果将它放在主报表的子报表中,则它出现在整个表格之后,而不是在我需要的所需组之后。

我可以在这做什么?

相关问题