我们如何在 BIRT 中进行分组而不浪费行,并且仍然只在第一行打印分组项?

发布于 2024-08-25 12:51:29 字数 1566 浏览 3 评论 0原文

在 BIRT 中分组时,我们经常希望分组值显示在第一行,如下所示:

Group   User                       Reputation
------  ---------------            ----------
Admins  Bill The Weasel                51,018
        Mark Grovel                   118,101
Users   Pax_my_bags_got_to_go          73,554
        Jon Scoot                  **,***,*** <- overflow
        Clueless                       92,928

实现此目的的正常方法是在设计器中按如下方式布置组:

        +---------+--------+--------------+
Tbl Hdr | Group   | User   |   Reputation |
        +---------+--------+--------------+
Grp Hdr | [Group] |        |              |
        +---------+--------+--------------+
Grp Dtl |         | [User] | [Reputation] |
        +---------+--------+--------------+
Grp Ftr |         |        |              |
        +---------+--------+--------------+
Tbl Ftr |         |        |              |
        +---------+--------+--------------+

不幸的是,它在 正是这样,分组值位于不同的行上:

Group   User                       Reputation
------  ---------------            ----------
Admins
        Bill The Weasel                51,018
        Mark Grovel                   118,101
Users
        Pax_my_bags_got_to_go          73,554
        Jon Scoot                  **,***,*** <- overflow
        Clueless                       92,928

对于有很多组只有一个用户的数据来说,这尤其痛苦,因为我们使用了所需空间的两倍。如果我们将[Group]数据项向下移动到Grp Dtl行,我们就会为组中的每一行打印它。

在 BIRT 中,我们如何合并两行 Grp Hdr 和第一行 Grp Dtl

When grouping in BIRT, we frequently want the grouping value to show up on the first line as follows:

Group   User                       Reputation
------  ---------------            ----------
Admins  Bill The Weasel                51,018
        Mark Grovel                   118,101
Users   Pax_my_bags_got_to_go          73,554
        Jon Scoot                  **,***,*** <- overflow
        Clueless                       92,928

The normal way of acheiving this is to lay out the group in the designer as follws:

        +---------+--------+--------------+
Tbl Hdr | Group   | User   |   Reputation |
        +---------+--------+--------------+
Grp Hdr | [Group] |        |              |
        +---------+--------+--------------+
Grp Dtl |         | [User] | [Reputation] |
        +---------+--------+--------------+
Grp Ftr |         |        |              |
        +---------+--------+--------------+
Tbl Ftr |         |        |              |
        +---------+--------+--------------+

which, unfortunately, lays out the data in exactly that way, with the grouped value on a different line:

Group   User                       Reputation
------  ---------------            ----------
Admins
        Bill The Weasel                51,018
        Mark Grovel                   118,101
Users
        Pax_my_bags_got_to_go          73,554
        Jon Scoot                  **,***,*** <- overflow
        Clueless                       92,928

This is particularly painful with data where there's lots of groups with only one user since we use twice as much space as needed. If we move the [Group] data item down to the Grp Dtl line, we get it printed for every line in the group.

How, in BIRT, do we merge the two lines Grp Hdr and the first Grp Dtl?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无力看清 2024-09-01 12:51:29

下面的答案是 Mystik 的原始答案,但是,尽我所能,我无法让它正常工作(尽管我没有尝试第二个建议,所以它可能会很好地工作)。这可能是由于我正在运行 BIRT 的后级(而且,不,不幸的是,我不允许升级,它是具有自己的发布周期的单独产品的一部分)。

我最终找到的解决方案是将数据值保留在分组行中并选择单元格(而不数据值),然后在属性下设置Drop控件GeneralDetail,而不是默认的None

这会在呈现报表时将数据值降低到详细信息行。

我正在编辑这个答案,而不是添加我自己的答案,因为我不想成为代表妓女:-)


尝试按照以下步骤操作:

  1. 按照您的方式创建组。
  2. 然后将组数据项向下拖动一行(见下文)。此时,如果您愿意,可以删除组标题行。
  3. 然后单击其中包含组数据项的列。
  4. 选择后,转到控件的属性资源管理器并滚动到底部,选择“高级”。
  5. 在高级列表中,您将看到一个名为“抑制重复”的属性。对于其中包含组数据的列,做到这一点,您就完成了。

    <前><代码> 抑制
    重复项
    +---------+--------+--------------+
    高清 Hdr |集团|用户 |信誉|
    +---------+--------+--------------+
    人类发展报告组 | | <-创建组后删除此行
    +---------+--------+--------------+
    组数据 | [群组] | [用户] | [信誉] |
    +---------+--------+--------------+
    组 Ftr | | | |
    +---------+--------+--------------+
    列表 Ftr | | | |
    +---------+--------+--------------+

The answer below was Mystik's original answer but, try as I might, I couldn't get it to work properly (though I didn't try the second suggestion so it may well work). That may be caused by the fact that I'm running a back level of BIRT (and, no, I'm not allowed to upgrade unfortunately, it's part of a separate product that has its own release cycles).

The solution I eventually found was to leave the data value in the grouping line and select the cell (not the data value), then set the Drop control under Properties, General to be Detail rather then the default None.

This brings the data value down to the detail line when rendering the report.

And I'm editing this answer rather than adding my own since I don't want to be a rep whore :-)


Try following these steps:

  1. Create the group just as you have.
  2. Then drag the group data item one row down (see below). At this point you can delete the group header row if you like.
  3. Then click on the column that has the group data item in it.
  4. Once selected, go the to the properties explorer for the control and scroll to the bottom, selecting "advanced".
  5. In the advanced list, you will see a property called "Suppress Duplicates". Make this true for the column with the Group data in it and you will be all set.

              Supress
             Duplicates
            +---------+--------+--------------+
    Tbl Hdr | Group   | User   |   Reputation |
            +---------+--------+--------------+
    Grp Hdr |                                 |  <-delete this row AFTER Group Creation
            +---------+--------+--------------+
    Grp Dtl | [Group] | [User] | [Reputation] |
            +---------+--------+--------------+
    Grp Ftr |         |        |              |
            +---------+--------+--------------+
    Tbl Ftr |         |        |              |
            +---------+--------+--------------+
    
杯别 2024-09-01 12:51:29

以前的解决方案效果很好,但我们没有找到隐藏组标题中内部边框的明显方法。
这就是我们找到的解决方案:

  1. 将详细信息行中的元素复制到标题行中的空单元格。
  2. 在 onCreate 事件上初始化循环变量

    <代码>i=0; // 在组标题行的 onCreate 属性中

  3. 更改“可见性”属性编辑器选项卡中的条件。根据条件检查“隐藏元素”

    i++ == 0

因此最终布局将如下所示:

<前><代码> +---------+--------+----------------+
|高清 Hdr |集团|用户 |
+---------+--------+--------------+
| [群组] | [用户] | [信誉] |
+---------+--------+--------------+
| | [用户] | [信誉] | <-- 这是隐藏第一个元素的行
+---------+--------+--------------+
| | | |
+---------+--------+--------------+

The previous solution works well, but we didn't find the obvious way to hide inner borders in group header.
So that's the solution we found out:

  1. Copy elements from detail row to empty cells in header row.
  2. Initialize loop variable on event onCreate

    i=0; // in onCreate property of group header row

  3. Change conditions in 'Visibility' property editor tab. Check "Hide element" against condition

    i++ == 0

So the final layout will look like:

   +---------+--------+--------------+
   | Tbl Hdr | Group  |    User      |
   +---------+--------+--------------+
   | [Group] | [User] | [Reputation] |
   +---------+--------+--------------+
   |         | [User] | [Reputation] | <-- that's the line that hide first element  
   +---------+--------+--------------+
   |         |        |              |
   +---------+--------+--------------+
等风也等你 2024-09-01 12:51:29

选择在其中输入或放置组数据的单元格,然后选择删除>属性资源管理器中的全部而不是

或者选择删除>另一个 group_data 和 data_field 单元格的详细信息

Select the cell in which group data is entered or placed and select Drop > All instead of None in Property Explorer.

Or select Drop > Detail for cells of another group_data and data_field cells.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文