Jump to content
We've recently updated our Privacy Statement, available here ×

Subreport isn't showing


blamblam

Recommended Posts

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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 1 year later...

<!-- 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...