Page Breaks with SubReports

By: Enygma - enygmatic
Page Breaks with SubReports
2006-02-22 09:27
I have a main report containing a subreport. The main report is populated via a datasource. This datasource has another datasource in it as a field. This datasource is used to populate the subreport. Now what I desire is that the report should break and begin on a new page with each new value of the datasource being passed to the subreport. (or something to that effect...hope i'm making some sense). How can I achieve this ?
I have tried putting the subreport on a group header and getting the group to break on a new page on change of the datasourec field. This is the recommended way for forcing page breaks I believe. However I have not been successful in this. I would greatly appreciate it, if someone could clearly explain to me how to go about what I am trying to achieve.
Thanks in advance

By: Aegis Thorne - aegisthorne
RE: Page Breaks with SubReports
2006-02-22 09:43
So, to clarify, you have one report with multiple rows, each of which has a datasource. The report is for running subreports multiple times with a different data source each time, and you want each subreport to print on a new page.

You can put the subreport in a group(inside the main report) and have the group expression $V{REPORT_COUNT}. Set the group to always display on a new page. This will create a page break for each row in the main report. Since the subreport is run once for each row, this should have the intended effect.

Note: you do not have to add anything to the group; it just has to be in the report.

Hope this helps,


By: Enygma - enygmatic
RE: Page Breaks with SubReports
2006-02-22 10:02
I did try that in iReport with no luck, however will give it another shot . Just wanted to also know what other group / band properties need to be set. Does Min height to start new page, is split allowed etc have to be set ??

By: Enygma - enygmatic
RE: Page Breaks with SubReports
2006-02-22 10:03
i'm using iReports 0.5.3 btw. Dunno if that makes any difference

By: Aegis Thorne - aegisthorne
RE: Page Breaks with SubReports
2006-02-22 11:31
None of the other settings are important. Just the page break part. The other defaults should work fine. I use JasperAssistant, so I couldn't tell you as far as iReports is concerned, but that shouldn't make a difference. The properties are ouput the jrxml and interpreted by Jasper regardless of the version of the design tool you are using.

Let me know if this works for you.

Good luck,


By: Enygma - enygmatic
RE: Page Breaks with SubReports
2006-02-25 04:37
Just found the weirdest thing with iReports. When I compiled or saved the report with the group it removed the isBreakonNewPage and other group page break related attributes from the group element.
it just saved the group element with two attributes like this
<group name="NewPage" isStartNewColumn="false" isResetPageNumber="false" >

No wonder page breaking didn't work. Is this a known bug in iReports ?

anyway will try compiling and generating the reports in my actual java environment and not the iReport test environment i used for report design.
Hopefully should work :-)

Thanks for the help Aegis, will keep u posted on how this goes
2006 IR Open Dicussion's picture
Joined: Aug 10 2006 - 3:24am
Last seen: 17 years 1 month ago

0 Answers:

No answers yet