将字段串联成一行 [英] concatenate fields into one single row

查看:103
本文介绍了将字段串联成一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望可以在Visual Studio 2008的Crystal Reports中完成此操作.
将以下数据发送到Crystal....
ID Val
1 A
1 C
1 F
2 C
2 B

...可以显示如下吗?
ID Val
1 A,C,F
2 C,B
预先感谢.

I hope this can be done in Crystal Reports for Visual Studio 2008.
Given the following data being sent to Crystal....
ID Val
1 A
1 C
1 F
2 C
2 B

...can it be displayed as follows?
ID Val
1 A, C, F
2 C, B
Thanks in advance.

推荐答案

是的,可以做到的.

选项1:
在QUERY级别:进行查询以返回此处显示的数据

选项2:
在报告"级别:按ID在报告中进行分组.

尝试!
Yes, it can be done.

Option 1:
At QUERY level: Make a query that returns the data as you showed here

Option 2:
At REPORT level: Do a grouping by ID in your report.

Try!


我已经搜索并尝试了此公式,但无法正常运行

组标题部分)
共享的stringvar b;
b:='''';

(详细信息部分)
在打印记录时;
共享的stringvar b;
如果不是IsNull({DaySheetReport; 1.Code}),则
(
如果(b ='''')然后
b:= b + {DaySheetReport; 1.Code}
其他
b:= b +'',''+ {DaySheetReport; 1.Code}
)


(组页脚部分)
共享的stringvar b;
b

它显示了这样的数据

1 A
1 A,C
1 A,C,F
2 C
2 C,B

代码有什么问题?
I have searched and tried this formula but it did not work correctly

Group Header section)
shared stringvar b;
b := '''';

(Detail section)
whileprintingrecords;
shared stringvar b;
if not IsNull({DaySheetReport;1.Code}) then
(
if (b = '''') then
b := b + {DaySheetReport;1.Code}
else
b := b + '', '' + {DaySheetReport;1.Code}
)


(Group Footer section)
shared stringvar b;
b

it shows the data like this

1 A
1 A,C
1 A,C,F
2 C
2 C,B

What is the problem with the code?


这篇关于将字段串联成一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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