包含和排除子报告(iReport-JasperReports) [英] Inclusion and exclusion of subreports (iReport-JasperReports)

查看:94
本文介绍了包含和排除子报告(iReport-JasperReports)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要根据条件包含或排除子报表。我正在使用iReport创建JasperReports。即,如果子报表具有值,则需要包含该子报表,否则不包括该子报表。任何人都可以发送样品或告诉我如何解决这个问题。

I need to include or exclude a subreport based on a condition. I'm using iReport to create JasperReports. I.e., if a subreport has values, I need to include that subreport, otherwise not. Can anyone please send a sample or tell me how to resolve this.

推荐答案

您可以在主报告中从您的数据中获取数据源代码,允许您识别是否应包含子报表,然后使用子报表元素上的'printWhenExpression'字段来检查该数据。

you can in the master report get data from your data source that allows you to identify if the subreport should be included, then use the 'printWhenExpression' field on the subreport element to check that data.

我经常使用这个 - 例如printWhenExpression字段可能包含:

I use this regularly - for example the printWhenExpression field may contain:

new Boolean($F{TOTAL_STATS}.intValue() != 0)

其中TOTAL_STATS来自主报告的数据库查询。如果非零,我们会显示一个详细说明某些数据的子报告。

where TOTAL_STATS is from the master report's database query. If non-zero we show a subreport detailing some data.

这篇关于包含和排除子报告(iReport-JasperReports)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆