I am working on a report that contains 8 subreports inside a detail band. All of these subreports have the potential to either not exist (with the exeption of the first subreport always existing), or have 1 to n rows, making the page height an unknown value. I would like it so each subreport starts on a new page. My current solution is this:
-- SubReport2 - With pagebreak at top of title band
-- SubReport3 - With pagebreak at top of title band
-- SubReport4 - With pagebreak at top of title band
-- SubReport5 - With pagebreak at top of title band
-- SubReport6 - With pagebreak at top of title band
-- SubReport7 - With pagebreak at top of title band
-- SubReport8 - With pagebreak at top of title band
This current solution works fine when the contents of previous subreport doesn't take up all of the page height. In cases where the previous subreport does this - the page break from the current subreport no longer fits on the previous subreport's page and instead inserts a page break on the following page. This means there is the occasional blank page in the middle of the report.
My question is - is there a better solution to generating each subreport on a new page, if not, is there a way I can modify the current structure so that I can achieve my desired look?
Here is a suggestion on how I often setup numerous "sub-reports".
Each band can have its own properties.
One of those properties is Start New Page.
I would have each dataset (subreport) in a new detail band. (right click and add detail band)
You can set the condition on whether they display or not to be if the dataset contains data if you are getting any blanks you don't want.
I need all of my subreports to start at the exact same height on each page. Is this possible with detail bands as I believe they follow on from the previous Y coordinates, meaning each subsequent subreport will fall below the one above it on the page.
Have you tried it yet?
I have never had that problem. When I have dozen of bands down the page only 1 ever true (radio parameter) they are all at the top of the page. (or relative to the headers)
If the band properties "Print when expression" does not result true I don't believe that band renders at all.
I made an example one for you.
Works fine for me without setting the Start New page property.
My trick is on all reports I create a variable called nothing with an expression of "" (blank).
Create a new group from the nothing variable.
and sett the reports when no data type to: All sections No detail.
I also always set the language from java to groovy because of issues i have seen in the past.
When I toggle from list1 to list2, only the list is visible and at the top of page.
See the print when expression for the two bands: