水晶报表;将多行数据组合成一个值 [英] Crystal report; Combining rows of data into a single value

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

问题描述

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

I have a data in rows like this for id 1

id1 a1

id1 b2

id1 c3

id1 d4

id1 e5

我喜欢将它作为a1b2c3d4e5"组合成 id1 的单个值.提前致谢.

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

推荐答案

一种方法是3公式"方法.您使用评估时间指令WhilePrintingRecords"在每个标题中设置一个初始化公式.在 RunningTotal 对象可用之前的好日子",这种方法是唯一可用于计算运行总计的方法.
例如:
在组标题中:- 有一个公式 @InitiliseRT

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 := "";

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

In the Details Section :- Have a Formula @UpdateRT

WhilePrintingRecords;
StringVar ConcatenatedID := ConcatenatedID + id1;

最后,您可以在 Group Footer 中看到结果:- 公式 @ShowRT

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

WhilePrintingRecords;
StringVar ConcatenatedID;

这应该会为您提供a1b2c3d4e5"的最终字符串.

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

如果需要,您可以为额外的组添加额外的公式,为每个组添加一个变量(例如 ConcatenatedIDGroup1、ConcatenatedIDGroup2).关键是始终在组之间获得正确的名称,并在组头中初始化变量.
这些公式的使用存在局限性.内置汇总函数(Sum、Max、Count、...)或 RunningTotals 无法使用它们,您也无法对其进行分组.

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