BIRT - 从多个数据集中添加总计
我在 BIRT 中有一份报告,我想在最后添加一个摘要。
该报告是 3 个具有自己的数据集的表。 我想显示第四个表,其中包含摘要信息和总计。 我无法计算总计。
前任:
DataSet #1
col1 | col 2 | Total
x | x | x
x | x | x
xx
DataSet #2
col1 | col 2 | Total
x | x | x
x | x | x
xx
DataSet #3
col1 | col 2 | Total
x | x | x
x | x | x
xx
Summary
Total DataSet #1 | xx
Total DataSet #2 | xx
Total DataSet #3 | xx
Grand Total | xxx
I have a report in BIRT and I want to add a summary at the end.
The report is 3 tables that have there own dataset. I want to show a fourth table with the summary information an a grand total. I have trouble calculating the grand total.
ex:
DataSet #1
col1 | col 2 | Total
x | x | x
x | x | x
xx
DataSet #2
col1 | col 2 | Total
x | x | x
x | x | x
xx
DataSet #3
col1 | col 2 | Total
x | x | x
x | x | x
xx
Summary
Total DataSet #1 | xx
Total DataSet #2 | xx
Total DataSet #3 | xx
Grand Total | xxx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经在前三个表中创建了必要的小计(我猜是通过一个组)。 在为包含总计的表格单元格创建脚本事件中,设置一个持久全局变量来跟踪每个小计。 然后,您可以访问第四个也是最后一个表中的每个值。
要设置变量:
注意:您需要将总计发送到“String”类型以确保序列化。 您可以在渲染最终汇总表时将其转换回数字。
要使用该变量,请将文本控件添加到报表中(在汇总表的单元格中)。 在文本控件的 onCreate 脚本事件中输入以下内容:
您将为之前保留的每个汇总字段执行此操作。 然后,对于总计,您可以执行以下操作:
持久全局变量只是一个可序列化的值,可以跨报表内的组件边界访问。 它可以非常方便地满足您的需求。
祝你好运!
You are already creating the necessary sub-totals in each of the first three tables (via a group I would guess). In the create scripting event for the table cell with your Grand Total, set a Persistent Global Variable to track each sub-total. You can then access each value inside the fourth and final table.
To set the variable:
NOTE: You will need to send the grand total to a "String" type to ensure serialization. You can convert it back to a number when you render the final summary table.
To use the variable, add a Text control to your report (in a cell on the Summary Table). In the onCreate scripting event for the text control enter the following:
You would do this for each summary field you retained earlier. Then for the Grand total, you can do this:
A Persistent Global Variable is simply a serializable value that can be accessed across component boundaries inside a report. It can come in very handy for requirements just like yours.
Good Luck!