I have done some research on subreports and have even built report that use several subreports.
I am having an issue combining 2 already made reports so that they both run and print out (one on first page, one on second page).
How can I do this? Do I have to include every single item in those reports SQL statements or just the parameters that cause for input?
I am using iReport to build my custom jasper reports,
You have 2 options
1. Combine report creating a main report and include you reports in this as subreport's. You need to set margin to 0,
whenNoDataType="AllSectionsNoDetail"
and for example use thesummary
band to generate new page for report2 settingisSummaryNewPage="true"
. You do not need to change any queries, since you simple pass the report connection to your reports (subreports).Example
2. Concatenate the report's during exporting
Example (pdf export is similar with other types of export)
There is now a third way to concatenate them, especially if the reports have different page size and/or orientation.
Instead of running them as subreports inside a master report, you can run them as parts inside a book report.
Please check the /demo/samples/book sample inside the JR Lib project distro package and you can see how 3 reports with different layouts are run together to produce a single file output.
Also, the /demo/samples/tableofcontents sample relies on this new type of report template, which we call book and is made of parts instead of bands.