0
votes

I am using JasperReports in my project. During the generation of reports, I am forced to retrieve data from different tables in the database. I have used subreports, but this solution is not satisfactory for me. Main reason for this is fact that for each report I have to prepare two jrxml files. For the assumptions of my project this is not effective.

Is there an alternative to subreports? If it is important I use Hibernate.

2
What is the reason that you cannot read all necessary data in the main query, to avoid sub-reports altogether?Markus Pscheidt

2 Answers

1
votes

Mateusz, you can prepare data source manually in java code and pass is to the report. Sometimes the good subreport's alternative is using group(s) in report.

0
votes

At a higher level what are you trying to achieve ?

If the reason you're using subreports is to embed mulitple graphs/chart widgets that display different but related data, then an alternative way to doing this is using subdatasets

Innformation on using subdatasets can be found in iReport Ultimate Guide, but basically they are extra sub queries you can run in addition to the main report query, whose results can be access by Charts/Charts Pro widgets (see the chart data tab in these widget properties)