Jump to content

Null sum returned from subreport


bbalmer

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:

Code:

<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"/>
<detail>
<band height="279">
<frame>
<reportElement x="2" y="60" width="583" height="97"/>
<box border="1Point" padding="0"/>
<frame>

</frame>
<frame>

</frame>
<frame>
<reportElement stretchType="RelativeToBandHeight" x="370" y="0" width="211" height="95"/>
<box border="None" padding="0"/>
<subreport>
<reportElement x="2" y="2" width="207" height="63"/>
<dataSourceExpression>
<![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{citOrdDtls})]]>
</dataSourceExpression>
<returnValue subreportVariable="totalDue" toVariable="totalDueGroceryTotal"/>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{GroceryTotals_Subreport}]]>
</subreportExpression>
</subreport>
<rectangle>
<reportElement positionType="FixRelativeToBottom" x="0" y="78" width="211" height="17" backcolor="#DFDFDF"/>
<graphicElement/>
</rectangle>
<staticText>
<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"/>
</textElement>
<text><![CDATA[Total Due:]]></text>
</staticText>
<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"/>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$V{totalDueGroceryTotal}]]></textFieldExpression>
</textField>
</frame>
</frame>
</band>
</detail>
</jasperReport>

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