Passing parameters from main report to subreport in Jasper
jasper-reports, subreport
Solution
Follow the steps below to pass parameters into subreports:
- Create main report parameter, such as `DATE_PARAM`.
- Open sub report and Create a parameter with the same name and the same type.
- Go back to main report
- Right-click on sub report, select properties
- Choose parameter
- Add parameter from main report to sub report with parameter name same parameter name
The parameter is passed from the main report to the subreport.
Problem
I have a JasperReport where I am passing the report Date from a Main Report to a sub report. This works fine. I also have another where I am passing the same parameter to a sub report that has multiple SubReports. When I preview it in Ireports all the pages for it appear blank which means the sub-sub reports are being called but the report Date is not being passed as all the sub-sub report SQL are conditioned on the report Date. How can I get the report Date field to the sub sub reports? When I preview the SubReport and type in the report Date all the report dates work all four pages are populated with the correct data.