我正在使用 Crystal Reports,并且我有这样的输出:
NumberId ART_No InkColor
------------------------------------------
0010 23003 BLUE
0010 23003 RED
0010 23003 GREEN
0013 23004 ORANGE
0013 23004 PINK
0013 23004 WHITE
0015 23007 GREEN
0015 23007 PINK
即使不使用 SQL 脚本,是否有任何可能的方法可以使输出(在 Crystal Reports 中)像这样:
NumberId ART_No InkColor
------------------------------------------
0010 23003 BLUE, RED, GREEN
0013 23004 ORANGE, PINK, WHITE
0015 23007 GREEN, PINK
谢谢
最佳答案
您需要做一些事情才能实现这一目标。
为
NumberId
创建一个组。隐藏组 header 。
创建一个公式字段;我们将其命名为
@ColorReset
。它应包含以下代码:WhilePrintingRecords; stringVar Colors := "";
Place this in your group header. This will reset the
Colors
stringVar every time the Group Header is hit.Suppress the Detail section.
Create another FormulaField; we'll call it
@ColorAppend
. It should concatenate the values like this:WhilePrintingRecords; stringVar Colors := Colors + ", " + {YourTable.InkColor};
Place this in your detail section. This will build your color string every time the Detail section loops.
Create one more FormulaField to show the colors, called
@ColorsShow
. It will display the colors like this:WhilePrintingRecords; StringVar Colors; RIGHT(Colors, LEN(Colors) - 2); // Strip off the leading comma and space
Place this in your group footer, along with the
NumberId
andART_No
Your end result should be:
---------- Group Header 1 ----------
/////////// @ColorReset ////////////
------------- Details --------------
////////// @ColorAppend ////////////
---------- Group Footer 1 ----------
[NumberId] [ART_No] [@ColorsShow]
看起来有点吓人,但它非常简单。
关于crystal-reports - Crystal Report 1 字段应位于同一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14701536/