crystal-reports - Crystal Report 1 字段应位于同一行

标签 crystal-reports crystal-reports-2008 crystal-reports-2010 crystal-reports-8.5

我正在使用 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

谢谢

最佳答案

您需要做一些事情才能实现这一目标。

  1. NumberId创建一个组。

  2. 隐藏组 header 。

  3. 创建一个公式字段;我们将其命名为@ColorReset。它应包含以下代码:

    WhilePrintingRecords;
    stringVar Colors := "";
    

    Place this in your group header. This will reset the Colors stringVar every time the Group Header is hit.

  4. Suppress the Detail section.

  5. 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.

  6. 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 and ART_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/

相关文章:

c# - 使用 C#.net 中的数据表将数据插入数据集中

c# - 尝试打印 Crystal 报表时出错

c# - Crystal 报表文档加载挂起

if-statement - Crystal report if then help,如何用公式返回字符串或变量

crystal-reports - Crystal 报表标题行颜色

crystal-reports-2010 - 将Crystal Report导出为PDF时,字体大小会减小

crystal-reports - 连接 Crystal 报表中的字符串字段

c# - 按月生成 Crystal 报表?

delphi - Crystal Reports 2008/2011 与 Delphi XE 的集成

mysql - VB.NET, MySQL & Crystal Report 两个表之间的比较语句