Jump to content
Changes to the Jaspersoft community edition download ×

Null sum returned from subreport


Recommended Posts

I've checked the forum and this seems pretty easy but for some reason I keep getting a null returned from the sum of my subreport.


I have a 'totalDue' java.lang.Double variable in my subreport doing a sum. If I print this out in the subreport it shows the total being calculated correctly as the rows are printed. I have this mapped to a totalDueGroceryTotal variable in the master report (java.lang.Double). This ALWAYS comes back as null. Any ideas?


Here is the master report:


<jasperReport name="OrderDetail" pageWidth="594" pageHeight="791" whenNoDataType="AllSectionsNoDetail" columnWidth="590" leftMargin="2" rightMargin="2" topMargin="5" bottomMargin="5">
<property name="com.jasperassistant.designer.DataSource" value="OrderDetailsDataSource"/>
<parameter name="GroceryTotals_Subreport" class="net.sf.jasperreports.engine.JasperReport"/>
<variable name="totalDueGroceryTotal" class="java.lang.Double" calculation="System"/>
<band height="279">
<reportElement x="2" y="60" width="583" height="97"/>
<box border="1Point" padding="0"/>


<reportElement stretchType="RelativeToBandHeight" x="370" y="0" width="211" height="95"/>
<box border="None" padding="0"/>
<reportElement x="2" y="2" width="207" height="63"/>
<![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{citOrdDtls})]]>
<returnValue subreportVariable="totalDue" toVariable="totalDueGroceryTotal"/>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{GroceryTotals_Subreport}]]>
<reportElement positionType="FixRelativeToBottom" x="0" y="78" width="211" height="17" backcolor="#DFDFDF"/>
<reportElement positionType="FixRelativeToBottom" x="2" y="80" width="80" height="13"/>
<textElement verticalAlignment="Middle">
<font fontName="Courier New" size="11" isBold="true" pdfFontName="Courier-Bold" isPdfEmbedded="true"/>
<text><![CDATA[Total Due:]]></text>
<textField pattern="¤#,##0.00;(¤#,##0.00)" isBlankWhenNull="true">
<reportElement positionType="FixRelativeToBottom" x="92" y="80" width="118" height="13"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Courier New" size="11" isBold="true" pdfFontName="Courier-Bold" isPdfEmbedded="true"/>
<textFieldExpression class="java.lang.Double"><![CDATA[$V{totalDueGroceryTotal}]]></textFieldExpression>

Link to comment
Share on other sites

  • Replies 3
  • 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...