Jump to content

Subreport duplex support across 2 datasets


Recommended Posts

I have a master report with 2 subreports. The subreports each have records that span more than one page. A subreport page is made up of 3 records each before a new page is triggered. I want to alternate between each subreport on a page-by-page basis. Say subreport 1 has 9 records generating a total of 3 pages i.e. 3 records per page. Subreport 2 also has 9 records also generating a total of 3 pages i.e. 3 records per page. What I want is the main report to run which has 3 pages then page 4 is page 1 of Subreport 1 and page 5 is page 1 of Subreport 2, page 6 is page 2 of Subreport 1, page 7 is page 2 of Subreport 2, page 8 is page 3 of subreport 1 and finally page 9 is page 3 of subreport 2.
One solution I tried is using the current page number and alternating between even and odd numbers.  So subreport1 prints on the odd number pages and subreport2 prints on the even number printers. Unfortunately, I ran into an issue with the page number controlling the visibility of a subreport. I can not be the only one who has come across such a requirement in this world of green agendas and was hoping someone can provide a sample template that supports duplex printing across two subreports.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic


Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.

Link to comment
Share on other sites


Thank you for your patience, we have not forgotten you. We need a little more time with our team of experts to come up with a solution. We will respond back with an answer as quickly as we can.

Link to comment
Share on other sites

Hi,

The only solution I see involves post-processing of JasperPrint objects/documents using the JasperReports library API, prior to their final export to PDF or the targeted export format.

This means writing custom code.

For example, the two subreports could be run normally, one after the other, but once the JasperPrint document obtained, the Java API could be used to reorder the pages inside it and maybe even change the page number in the page footers, if needed.

I hope this helps.

Teodor

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...