I am using iReports 4.7.1
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 have two question to ask,
- Why the value is becoming null if i use in same band?
- Is their any other way to hide subreport returns no rows?
I followed this steps to create variable and return value from subreport to main report.
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.
Why the value is becoming null if i use in same band?
I need to see jrxml but probably you do not have correct EvaluationTime on the textField, try to set
Band
orReport
exampleevaluationTime="Report"
on the textField.Is their any other way to hide subreport returns no rows?
The normal way to remove an empty subreport is by setting
isRemoveLineWhenBlank="true"
on thereportElement
of the subreport.Make sure your subreport return no page (empty) when no data by setting the
whenNoDataType="NoPages"
(or removing this attribute since this default) on thejasperReport
tagThis 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 ispositionType="FixRelativeToTop"