subreports not collpasing when empty
Posted on March 18, 2016 at 9:33am
hi guys,
i've two subreports printing in the summary of the main report. when there's no data in the subreports i'd like them be collapsed.

in order to do that i've set When No Data Type to No Pages in the subreports and i've set Remove Line When Blank to true to both subreports in the main report.
unfortunately it's not working. the subreports are taking all the space even if they're empty.

i've tried to delete the subreports to see if they're the cause and that's it.

awaiting your help!
Joined: Sep 22 2015 - 11:44pm
Last seen: 6 years 8 months ago
Posted on March 21, 2016 at 4:47am
Hi,
Have you tried a print when condition such that the sub-report doesn't get printed if the report count is null? If not, give it a try for respective subreports in the main report.
Regards,
KKriplani
Joined: Sep 4 2015 - 2:18am
Last seen: 1 year 5 months ago
Posted on March 21, 2016 at 5:44am
hi KKriplani... thanks for your suggestion! i've already tried but i wasn't able to get it working! if you suggest is the right way to do that, i'll re-try... will let you know!
Joined: Sep 22 2015 - 11:44pm
Last seen: 6 years 8 months ago
Posted on March 21, 2016 at 6:33am
KKriplani, lucianc,
seems it's not the subreports... following KKriplani's suggesion i've tried ot use the REPORT_COUNT to do it and i've found out the following.
exists_clause and exists_discount_surcharge are the main report variables coming from the subreport's REPORT_COUNTs. i've placed them in order to debug:

previewing it, the first page is taking a lot of space after the detail:

but i see it's not due to the subreports... they're not printed when REPORT_COUNT is equal to 0. everything after detail goes to the second page:

any idea why there's so much space after detail?
Joined: Sep 22 2015 - 11:44pm
Last seen: 6 years 8 months ago
Posted on March 21, 2016 at 8:27am
just to be complete... here's how it looks like when the subreports are returning something!

Joined: Sep 22 2015 - 11:44pm
Last seen: 6 years 8 months ago
Posted on March 22, 2016 at 12:57am
Joined: Sep 22 2015 - 11:44pm
Last seen: 6 years 8 months ago
Posted on March 22, 2016 at 3:57am
moving everything from summary to a new detail 2 band makes it better...
but it doesn't sound right... does that make sense to you?



Joined: Sep 22 2015 - 11:44pm
Last seen: 6 years 8 months ago
Posted on March 22, 2016 at 1:12pm
Idea off the top of my head. Haven't tried it.
Can you use a Return Parameter, and then use a Print when Return Parameter .equals(null) ?
I just tried this, and I had no luck making it work. Sorry.
Joined: Jul 10 2015 - 1:17pm
Last seen: 6 years 1 month ago
hi guys! just a hint after the we? :)
What vesion are you using? Removing the space seems to work fine for me. A (self contained) test case would of course help.
hi lucianc! thanks for your answer... i'm using 6.2.0.
what do you mean by "A (self contained) test case"?
A self contained test case means a set of jrxmls (and a static data source if required) that can be used to reproduce the problem on a different machine.
hi lucianc,
here are all ther jrxmls to build the report:
https://dl.dropboxusercontent.com/u/49472099/jrxmls.zip
you can run them with One Empty Record datasource and you'll see the following:
page 1
page 2