如何根据同一波段的子报表的返回值给出细节波段的表达式? [英] How to give expression for the details band based on the return value from subreport of the same band?
问题描述
我正在使用iReports 4.7.1
I am using iReports 4.7.1
我的主报告中有2个子报告,它们属于乐团.如果子报表未返回任何行,则需要隐藏区域.我可以在主报表中获得子报表的价值.但是,如果我将该变量用作同一区域中的表达式,则该变量的值将为null;如果我在其他明细区域中使用该变量,则该值将不会为null.
I have 2 sub reports in my main report and they are in saperate bands. I need to hide the band if sub report returns no rows. I am able to get subreport value in my main report. But if i use that variable as a expression in the same band the value of that variable is becoming null, If i use that same variable in other details band, it is not becoming null.
我有两个问题要问
- 如果我在同一频段中使用,为什么值会变为空?
- 他们是否还有其他隐藏子报表的方式没有返回行?
我遵循了此创建变量并将值从子报表返回到主报表的步骤.
I followed this steps to create variable and return value from subreport to main report.
我也尝试了这个新的布尔值($ V {SUB_REPORT_ROW_CNT} .intValue()!= 0)或 $ V {SUB_REPORT_ROW_CNT}!= null 打印中的表达式当乐队表达的时候.
And also i tried this new Boolean($V{SUB_REPORT_ROW_CNT}.intValue()!=0) or $V{SUB_REPORT_ROW_CNT} != null expression in print when expression for the band.
推荐答案
如果我在同一频段中使用,为什么值变为空?
我需要查看jrxml,但可能您没有正确的,尝试在textField上设置Band
或Report
示例evaluationTime="Report"
.
I need to see jrxml but probably you do not have correct EvaluationTime on the textField, try to set Band
or Report
example evaluationTime="Report"
on the textField.
其他隐藏子报表的方法是否不返回任何行?
删除空子报表的通常方法是在子报表的reportElement
上设置isRemoveLineWhenBlank="true"
.
The normal way to remove an empty subreport is by setting isRemoveLineWhenBlank="true"
on the reportElement
of the subreport.
通过在jasperReport
上设置whenNoDataType="NoPages"
(或删除此属性,因为默认设置),确保没有数据时,子报表返回无页面(空).标签
Make sure your subreport return no page (empty) when no data by setting the whenNoDataType="NoPages"
(or removing this attribute since this default) on the jasperReport
tag
这将删除子报表,请注意,但是如果您希望移动其下方的文本,则需要设置positionType="Float"
,否则它们将保留在原处,因为默认值为positionType="FixRelativeToTop"
This will remove the subreport, note however if you like text under it to move you need to set positionType="Float"
, otherwise they will remain where they are since default is positionType="FixRelativeToTop"
这篇关于如何根据同一波段的子报表的返回值给出细节波段的表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!