Jump to content
We've recently updated our Privacy Statement, available here ×

Returnvalue from subreport


gellie

Recommended Posts

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

hi,

this is the code from the subreport:

<field name="creditAmount" class="java.lang.Double">
        <fieldDescription><![CDATA[annuity/creditAmount]]></fieldDescription>
    </field>

    <variable name="summe_annu" class="java.lang.Double" resetType="Report" calculation="Sum">
        <variableExpression><![CDATA[$F{creditAmount}]]></variableExpression>
    </variable>

the mainreport:

returnvar: <variable name="Summe_Annu" class="java.lang.Double" resetType="Report" calculation="System">
    </variable>

the subreport call:

<subreport  isUsingCache="true">
                    <reportElement
                        x="10"
                        y="24"
                        width="80"
                        height="10"
                        key="subreport-3"
                        positionType="Float"/>
                    <subreportParameter  name="XML_DATA_DOCUMENT">
                        <subreportParameterExpression><![CDATA[$P{XML_DATA_DOCUMENT}]]></subreportParameterExpression>
                    </subreportParameter>
                    <returnValue subreportVariable="summe_annu" toVariable="Summe_Annu" calculation="Sum"/>
                    <returnValue subreportVariable="var" toVariable="var"/>
                    <subreportExpression  class="java.lang.String"><![CDATA[".\WIB_DV_subreport_darl.jasper"]]></subreportExpression>
                </subreport>

returnvariable output :

<textField isStretchWithOverflow="false" pattern="#,##0.00" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="180"
                        y="16"
                        width="100"
                        height="20"
                        key="textField"/>
                    <box></box>
                    <textElement>
                        <font/>
                    </textElement>
                <textFieldExpression   class="java.lang.Double"><![CDATA[$V{Summe_Annu}]]></textFieldExpression>
                </textField>

 

 

hope it is ok so

thx

Link to comment
Share on other sites

thx for you answer,

I´m not sure if I understand you right...the subreport is called once...if I execute it standalone the value is ok...if I execute the mainreport, the value of the variable in the subreport is like the value of the returnvar.

I set calculation to nothing for the returnvalue, nothing changes...

I need to sum the values in the subreport and return them to the mainreport...

What is wrong?

 

*EDIT*

it seems that the type of the variable is the reason for this problem...if I work without returning (just calling the subreport and display it in the master) values, there is still the same problem...if I change the fieldtype into string the value is ok, if it is an integer it is wrong..



Post Edited by Frank Gellhorn at 12/09/08 16:14
Link to comment
Share on other sites

Sorry, got pulled into a time sensitive project. I've never run into this sort of problem unless I put the subReport into the detail (or group header/footer) of a master report that returns multiple rows as its data source.

 

For instance:

Master Report data source: SELECT * FROM tbl WHERE rowID BETWEEN 0 AND 10

 

Then in the Master's Detail section I insert the subReport (subA) and have it return a calculated total(s) (mTotalA) back to the master variable (mSubReportA_Total) using a Calculation Type of SUM on the definition of mSubReportA variable.

.

Admittedly, I'm no expert in reading the xml, but it looks to me that the variables are all defined as java.lang.Double, so there shouldn't be any weird conversions going on there.

.

With that, I'm not sure what might be causing it unless it's a layout issue, sorry.

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