t3_chris Posted September 1, 2008 Share Posted September 1, 2008 Hi!As of my Report and Application Design i am in need to use nested SubReports. Think of the following structure:ToplevelReport (My Main Report) SublevelReport1 (Subreport of ToplevelReport)SublevelReport2 (Subreport of ToplevelReport)SubSublevelReport1 (Subreport of SublevelReport2) I do want to handover the Subreports to the MainReport by the Parameter Map, not by file (via $P{SUBREPORT_DIR} . My .jrxml Files define Subreports like this:<subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{SublevelReport2}]]></subreportExpression> How do i pass the Parameter for SubSublevelReport1 to SublevelReport2? I know that i can hand over the both childs of Toplevel Report by a call like this: Map<String, Object> parametersMainReport = new HashMap<String, Object>();parametersMainReport.put("SublevelReport1", compiledSublevelreport1)parametersMainReport.put("SublevelReport2", compiledSublevelreport2)JasperPrint jasperPrint = JasperFillManager.fillReport(compiledToplevelreport, parametersMainReport);But how can i pass SubSublevelReport1 to SublevelReport2 (which is the parent of SubSublevelReport1)? I don't want to pass the Reports as Files ($P{SUBREPORT_DIR}) as my Reports are stored in a SQL Database. Best Regards, christian Link to comment Share on other sites More sharing options...
C-Box Posted September 2, 2008 Share Posted September 2, 2008 Just also pass your "SubSublevelReport1" as Parameter to the main Report.There pass it to SubReport2 (in iReport it's at SubReport Properties --> Tab "Subreport other" where you can pass parameters from master to subreports)And at SubReport2 you can use the $P{SubSublevelReport1} as SubReportExpression! Don't forget to create the $P{SubSublevelReport1} at each level (Master/SubReport2) in the report parameters. voilá thats it!works great for me since years! :-)regards C-Box Link to comment Share on other sites More sharing options...
t3_chris Posted September 2, 2008 Author Share Posted September 2, 2008 Thanks a lot, that did the job. Best Regards, christian Link to comment Share on other sites More sharing options...
anshu.thada Posted August 1, 2017 Share Posted August 1, 2017 Wow, it works great for me too! Thank you so much for sharing! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now