Jump to content

conditional export for csv format


atiquek

Recommended Posts

Hi Gurus,

I have created a report which includes 3 subreports. The subreports subreport1 and subreport2 have been placed in a frame and needs to be displayed together. The 3rd subreport subreport3 is placed in a frame as well. Both these frames overlap each other.

The idea is to always display the frame with the 2 subreports. When this report will be exported to csv format then the frame with the subreport3 should be exported else the frame with subreport1 & subreport2 should be exported.

The problem is I am getting both the frames printed in the default view. Could someone please advise/point how do I hide the subreport3 frame when viewing it and export it to csv based on user selection. The detail band is given as follows:

<property name="net.sf.jasperreports.export.csv.exclude.origin.keep.first.band.1" value="columnHeader"/>
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.2" value="pageFooter"/>
    <property name="net.sf.jasperreports.export.csv.exclude.key.normal" value=""/>
    <property name="net.sf.jasperreports.export.pdf.exclude.key.csv" value=""/>
    <property name="net.sf.jasperreports.export.html.exclude.key.csv" value=""/>
    <property name="net.sf.jasperreports.export.xls.exclude.key.csv" value=""/>
    <property name="net.sf.jasperreports.export.xlsx.exclude.key.csv" value=""/>
    <property name="net.sf.jasperreports.export.docx.exclude.key.csv" value=""/>
    <property name="net.sf.jasperreports.export.rtf.exclude.key.csv" value=""/>
    <property name="net.sf.jasperreports.export.odt.exclude.key.csv" value=""/>
    <property name="net.sf.jasperreports.export.ods.exclude.key.csv" value=""/>
    <property name="net.sf.jasperreports.export.swf.exclude.key.csv" value=""/>

<detail>
        <band height="41" splitType="Stretch">
            <frame>
                <reportElement key="normal" stretchType="RelativeToTallestObject" x="0" y="0" width="575" height="40" isRemoveLineWhenBlank="true"/>
                <subreport isUsingCache="false" runToBottom="false">
                    <reportElement key="" x="0" y="0" width="389" height="40"/>
                    <subreportParameter name="stationid">
                        <subreportParameterExpression><![CDATA[$F{id}]]></subreportParameterExpression>
                    </subreportParameter>
                    <subreportParameter name="description">
                        <subreportParameterExpression><![CDATA[$F{description}]]></subreportParameterExpression>
                    </subreportParameter>
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    <subreportExpression><![CDATA["AqmBarChart1.jasper"]]></subreportExpression>
                </subreport>
                <subreport isUsingCache="false" runToBottom="false">
                    <reportElement key="" x="389" y="0" width="186" height="40"/>
                    <subreportParameter name="stationid">
                        <subreportParameterExpression><![CDATA[$F{id}]]></subreportParameterExpression>
                    </subreportParameter>
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    <subreportExpression><![CDATA["AqmChartDesc1.jasper"]]></subreportExpression>
                </subreport>
            </frame>
            <frame>
                <reportElement key="csv" x="0" y="0" width="575" height="40" isRemoveLineWhenBlank="true"/>
                <subreport isUsingCache="false">
                    <reportElement key="" x="0" y="0" width="575" height="40" isRemoveLineWhenBlank="true"/>
                    <subreportParameter name="stationid">
                        <subreportParameterExpression><![CDATA[$F{id}]]></subreportParameterExpression>
                    </subreportParameter>
                    <subreportParameter name="description">
                        <subreportParameterExpression><![CDATA[$F{description}]]></subreportParameterExpression>
                    </subreportParameter>
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    <subreportExpression><![CDATA["AqmCsv.jasper"]]></subreportExpression>
                </subreport>
            </frame>
        </band>
    </detail>

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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