blamblam Posted May 3, 2021 Share Posted May 3, 2021 Hello, I'm trying to pass a parameter from Java to Jaspersoft including a subreport that I've compiled into a JasperReport and some other values:def subReport = classPathResourceLoader.getResourceAsStream("classpath:reports/subReport.jrxml");parameters.put("subReport", JasperCompileManager.compileReport(subReport.get()));[/code]I've also changed the main report's source code to use the parameters passed:<subreport> <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression> <subreportParameter name="firstName"> <subreportParameterExpression><![CDATA[$P{firstName}]]></subreportParameterExpression> </subreportParameter> <subreportExpression><![CDATA[$P{subReport}]]></subreportExpression></subreport>[/code]As you can see I've also passed another parameter called firstName and I'm displaying it as well, however the subreport still isn't showing. What am I lacking? I hope you can help, thanks. Link to comment Share on other sites More sharing options...
blamblam Posted May 7, 2021 Author Share Posted May 7, 2021 Thank you, I can't believe I missed that. Link to comment Share on other sites More sharing options...
mahadiosb Posted November 23, 2022 Share Posted November 23, 2022 <!-- This is the size of your report --><reportElement x="0" y="0" width="200" height="100" uuid="8f4cd4e3-6e61-4116-baa9-7f819d8fc142"/><subreportParameter name="param"> <subreportParameterExpression><![CDATA[$P{param}]]></subreportParameterExpression></subreportParameter><!-- By Default you have to put this --> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <!-- Here is the path of your jasper file --> <subreportExpression><![CDATA[C:subReport.jasper"]]></subreportExpression> <!-- you can pass also using parameter --> <subreportExpression><![CDATA[$P{subReportPath}]]></subreportExpression></subreport> Link to comment Share on other sites More sharing options...
mahadiosb Posted November 23, 2022 Share Posted November 23, 2022 okay 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