stephen whitehead Posted October 17, 2019 Share Posted October 17, 2019 Hi there, 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:Master report-- SubReport1-- 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 bandThis 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?Regards,Steve Link to comment Share on other sites More sharing options...
danoldenkampgmail.com Posted October 18, 2019 Share Posted October 18, 2019 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. Link to comment Share on other sites More sharing options...
stephen whitehead Posted October 21, 2019 Author Share Posted October 21, 2019 Hi Dan,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.Regards,Steve Link to comment Share on other sites More sharing options...
danoldenkampgmail.com Posted October 21, 2019 Share Posted October 21, 2019 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. Link to comment Share on other sites More sharing options...
stephen whitehead Posted October 22, 2019 Author Share Posted October 22, 2019 Hi DanI have been having issues trying to apply the Start New Page property in the jrxml. Would you be able to provide me a snippet of one of your reports that implements this feature so that I can try it myself?Cheers for the continued help,Steve Link to comment Share on other sites More sharing options...
danoldenkampgmail.com Posted October 22, 2019 Share Posted October 22, 2019 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.See attachment.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:$P{SubReportSelector}=="list1" and$P{SubReportSelector}=="list2" 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