我们如何在 BIRT 中进行分组而不浪费行,并且仍然只在第一行打印分组项?
在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
下面的答案是 Mystik 的原始答案,但是,尽我所能,我无法让它正常工作(尽管我没有尝试第二个建议,所以它可能会很好地工作)。这可能是由于我正在运行 BIRT 的后级(而且,不,不幸的是,我不允许升级,它是具有自己的发布周期的单独产品的一部分)。
我最终找到的解决方案是将数据值保留在分组行中并选择单元格(而不数据值),然后在
属性下设置
、Drop
控件General
为Detail
,而不是默认的None
。这会在呈现报表时将数据值降低到详细信息行。
我正在编辑这个答案,而不是添加我自己的答案,因为我不想成为代表妓女:-)
尝试按照以下步骤操作:
在高级列表中,您将看到一个名为“抑制重复”的属性。对于其中包含组数据的列,做到这一点,您就完成了。
<前><代码> 抑制
重复项
+---------+--------+--------------+
高清 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 underProperties
,General
to beDetail
rather then the defaultNone
.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:
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.
以前的解决方案效果很好,但我们没有找到隐藏组标题中内部边框的明显方法。
这就是我们找到的解决方案:
在 onCreate 事件上初始化循环变量
<代码>i=0; // 在组标题行的 onCreate 属性中
更改“可见性”属性编辑器选项卡中的条件。根据条件检查“隐藏元素”
i++ == 0
因此最终布局将如下所示:
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:
Initialize loop variable on event onCreate
i=0; // in onCreate property of group header row
Change conditions in 'Visibility' property editor tab. Check "Hide element" against condition
i++ == 0
So the final layout will look like:
选择在其中输入或放置组数据的单元格,然后选择删除>属性资源管理器中的全部而不是无。
或者选择删除>另一个 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.