Jump to content
Changes to the Jaspersoft community edition download ×

How to prevent a query within a subdata set to run if its not used.


rayc.arc

Recommended Posts

We are using Jaspersoft 6.1 for generating reports in csv and pdf formats. We have different queries for charts (within subdataset). The charts are only available for PDF format and not for csv format, but still the queries for charts are being invoked for csv even if its not being used.

Is there any way to prevent the chart queries getting invoked for csv.

Snapshot of the jrxml which we are using

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Applications" columnCount="10" pageWidth="1060" pageHeight="1000" whenNoDataType="AllSectionsNoDetail" columnWidth="100" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.1" value="pageHeader"/>
    <subDataset name="xyz">
        <parameter name="something" class="java.lang.Long"/>
        <queryString>
            <![CDATA
]>
        </queryString>
        <field name="something" class="java.lang.String"/>
    </subDataset>
<pageHeader>
        <band height="482" splitType="Stretch">
              <frame>
                 <pieChart>
                    <chart evaluationTime="Report">
                       
                    </chart>
                    <pieDataset>
                        <dataset>
                            <datasetRun subDataset="xyz">
 
                             </datasetRun>
                       </dataset>
                  </pieDataset>
               </pieChart>
            </frame>
        </band>
    </pageHeader>
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

from my experience you have the following options.
1)Make a separate report for the cvs data
2)Pass a parameter to the report that is evaluated for the detail or
summary band. Using print when expression under:
 Band -> Properties -> Advanced in Jasper Studio
or in jrxml
<band>
<printWhenExpression> </printWhenExpression>
</band>

Link to comment
Share on other sites

Actually we don't want to have different jrxml for different report types, it would introduce more problem with maintenance.

Regarding the other approach, actually I am not clear. Let me tell you whatever I had tried so far.

The chart section is already within a band which is being disabled for csv format. Since the query for chart is different from the main query it is part of "subdataSet" element tag. The particular subdataSet is invoked for the chart using "datasetRun". Now the problem is even if the band where chart is present is disabled the query within the dataset is run. I had tried pulling the subdataSet section within the chart band which is actually not possible since its not a valid schema.

 

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