3

I have a requirement where i need to show or hide subreport based on user selection.

Say I have a Main report and two sub reports: sub1 and sub2.

User selects to show only sub1. The boolean value will be sent through Java.

I need to show main report with sub1 in it and hide sub2.

I tried <printwhenexpression> but no matter what it shows only main report.

<subreport>
    <reportElement uuid="25895ea2-ed3d-49d2-997b-f0e4e6e304a3" mode="Transparent" x="0" y="0" width="555" height="38">
        <printWhenExpression><![CDATA[($P{flag}==Boolean.TRUE)]]></printWhenExpression>
    </reportElement>
    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
    <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "subreport1.jasper"]]></subreportExpression>
</subreport>
4

0 回答 0