jcullison Posted October 11, 2007 Share Posted October 11, 2007 I have a master detail report with a subreport in the detail band of the master report. When the subreport has no data I want to get rid of the space the subreport would have taken. Right now, the rows on the master report are basically double spaced when there is no detail. The data should look like this:Code:master record 1master record 2 detail record 2a detail record 2bmaster record 3master record 4 detail record 4a detail record 4b But instead it looks (incorrectly) like this:Code:[code]master record 1<blank row>master record 2 detail record 2a detail record 2bmaster record 3<blank row>master record 4 detail record 4a detail record 4b Things I have tried:set RemoveLineWhenBlank on the subreport componentset the no data behavior of the subreport to "no pages"shrink subreport component very small Shrinking the subreport component to 0 seems to work. But it makes the report hard to maintain in iReport, since there is just a black line representing the subreport, and in my case it is at the bottom of the detail band, right on top of a subreport at 0 in the group footer band. I can't visually see it, but I can find it in the Document Structure view. I don't think this is iReports fault. I think this is a shortcoming of JasperReports. I'm not sure how yet, but I think there should be a way to make this more useable, such as an option on the subreports that subtracts their component height from the band they reside on, but only when they had no records or their printWhenExpression chose to not print. Make any sense? Thanks,Jim Post edited by: jcullison, at: 2007/10/10 17:24Post edited by: jcullison, at: 2007/10/10 19:12 Link to comment Share on other sites More sharing options...
C-Box Posted October 11, 2007 Share Posted October 11, 2007 Well I think this is the most often "beginner" error made... (at least I guess so, and most of our customer do so). If you have set an element to "RemoveLineWhenBlank" you have to set the elements below to PositionType to "float" instead standard FixRelativeToTop. Otherwise the Position you gave the lower elements in design are fixed regardless if there is an element removed when blank. give it a try... hthC-Box Link to comment Share on other sites More sharing options...
jcullison Posted October 11, 2007 Author Share Posted October 11, 2007 The float makes sense to me. The problem still remains though. You are talking about components below the subreport in the same band. In my case there are no components below (in the same band). The detail band just stays the same size as I set it originally but I want it to shrink. So in iReports the setup looks like this:Code:~~~Group Header Band~~~~~~~~~~~~~~~~~~~~~~~~header header header~~~Detail Band~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~---------- ---------- ----------$F{field1} $F{field2} $F{field3}---------- ---------- -------------------------------Detail SubReportComponent---------------------~~~Group Footer Band~~~~~~~~~~~~~~~~~~~~~~~~---------------------Group Totals SubReportComponent--------------------- Then the space from the fields down to the bottom of the detail band is kept and output on the report. So output, even with "float" set still is:Code:[code]text text text<blank line>text text text---sub report text---sub report text2text text text <blank line>text text text <blank line>group totals line1group totals line2 Ultimately I want lines from the master records to be as close together as possible (with a few pixels space of course). Link to comment Share on other sites More sharing options...
jcullison Posted October 11, 2007 Author Share Posted October 11, 2007 Resolved. I'm not sure why it wasn't working before, but I think it has to do with exact placement of things. At this point I have my fields 11 pixels high, top 0. My subreport is also 11 pixels high, top 11. Detail band height is 22 pixels. Subreport component is set to "remove line when blank" and position type to "float". Now I can fit many more lines onto a report (~50 with page headers and page footers), thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now