水晶报告;将数据行合并为单个值 [英] Crystal report; Combining rows of data into a single value

查看:210
本文介绍了水晶报告;将数据行合并为单个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在id为1的行中有一个数据



id1 a1



id1 b2

id1 c3



id1 d4



id1 e5



我喜欢将它作为a1b2c3d4e5合并为id1的单个值。先感谢。

解决方案

一种方法是3公式方法。您在每个标题中使用评估时间指令WhilePrintingRecords设置初始化公式。此方法是唯一可用于在RunningTotal对象可用之前在良好状态中运行总计的方法。

例如:

在组头中: - 有一个公式 @InitiliseRT

  WhilePrintingRecords; 
StringVar ConcatenatedID;
如果Not InRepeatedGroupHeader then
ConcatenatedID:=;

在详细信息部分: - 有一个公式 @UpdateRT

  WhilePrintingRecords; 
StringVar ConcatenatedID:= ConcatenatedID + id1;

最后,在组页脚中,您可以看到结果: - @ShowRT

  WhilePrintingRecords; 
StringVar ConcatenatedID;

这将给你最后一个字符串a1b2c3d4e5。



如果需要,可以为额外的组添加额外的公式,每个组一个变量(例如ConcatenatedIDGroup1,ConcatenatedIDGroup2)。关键是始终在组之间获取正确的名称,并在组头中初始化变量。

这些公式的使用存在限制。内置的汇总函数(Sum,Max,Count,...)或RunningTotals不能使用它们,您不能对它们进行分组。


I have a data in rows like this for id 1

id1 a1

id1 b2

id1 c3

id1 d4

id1 e5

I like to combine it as "a1b2c3d4e5" into a single value for id1. Thanks in advance.

解决方案

One approach is the "3 Formula" method. You set up an initialising formula in each header, with the evaluation time directive "WhilePrintingRecords". This approach was the only one available for doing running totals in the "good ol' days" before RunningTotal objects were available.
For example:
In the Group Header :- Have a Formula @InitiliseRT

WhilePrintingRecords;
StringVar ConcatenatedID;
If Not InRepeatedGroupHeader Then
    ConcatenatedID := "";

In the Details Section :- Have a Formula @UpdateRT

WhilePrintingRecords;
StringVar ConcatenatedID := ConcatenatedID + id1;

Finally, in the Group Footer you can see the result :- Formula @ShowRT

WhilePrintingRecords;
StringVar ConcatenatedID;

This should give you your final string of "a1b2c3d4e5".

If you need to, you can add extra formulas for extra groups, one variable for each group (e.g. ConcatenatedIDGroup1, ConcatenatedIDGroup2). The key is to always get the name right between the groups, and to initialise the variable in the group header.
There are limitations to the use of these formulas. The built in summary functions (Sum, Max, Count, ...) or RunningTotals cannot use them, and you cannot group on them.

这篇关于水晶报告;将数据行合并为单个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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