Load Sub Reports dynamically

Hi All, I am using Jasper Report to generate report from the Java code. The report designer I am using is iReport. Along with a master report there are several sub reports also available. Now, my question here is, do Jasper Report API has any way to load sub reports dynamically into master report? Here is example: A master report have three sub report. SubReport1, SubReport2 & SubReport3. Now the order of these sub reports displayed in a master report is not specific. It is based on the user inputs. So if user wants to display SubReport2 before SubReport1 then the user have to provide input accordingly. So, is there any way using which we can achieve this functionality using JasperReport API?
parthbhagat's picture
Joined: Aug 22 2010 - 11:26pm
Last seen: 3 years 2 weeks ago

1 Answer:

Define a parameter into master report that contains the subreport name.

Use the parameter into "Print when Expression" or "Subreport Expression" properties to manage how subreport to load.

federico.cattozzi's picture
Joined: Sep 22 2009 - 4:34am
Last seen: 9 years 6 months ago