简体   繁体   English

JasperReports / iReport Designer:我可以有条件地展示乐队吗?

[英]JasperReports / iReport Designer: Can i show a band conditionally?

I have created a report as follow: 我创建了如下报告:

Multiple detail band each detail band contains 1 table. 多个详细信息带,每个详细信息带包含1个表。 Each table is linked to 1 dataset. 每个表都链接到1个数据集。

Can I hide the detail band whenever the result set of the query returns Empty set (no result found)? 每当查询的结果集返回空集(找不到结果)时,是否可以隐藏明细区域?

how can I achieve this? 我该如何实现?

In the "Properties" of each Detail band you have an option called "Print When Expression" there you can place logic that evaluates to boolean . 在每个详细信息区域的“属性”中,有一个名为“表达式时打印”的选项,您可以在其中放置评估为boolean

When you fill it with your logic and it returns true this detail band is printed. 当您使用逻辑填充它并返回true ,将打印此详细信息带。

So, you will need to have the information if the table will be filled in advance and cannot address the dataset within. 因此,如果表格将被预先填充并且无法访问其中的数据集,则您将需要信息。

If your datasets are too different to do this, you should overwrite the Dataset for the main report with a custom one that gathers the information and sets the fields appropriately. 如果您的数据集太不同而无法执行此操作,则应使用自定义报告覆盖主报表的数据集,该自定义报告将收集信息并适当地设置字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM