gellie Posted December 1, 2008 Share Posted December 1, 2008 Hi @ all, i have a subreport which calculates a value in the summary...this value is e.g. 1.500.In my mainreport the returnvalue is 150.000...how could this be? Link to comment Share on other sites More sharing options...
gellie Posted December 3, 2008 Author Share Posted December 3, 2008 no ideas? Link to comment Share on other sites More sharing options...
dprogrammer Posted December 3, 2008 Share Posted December 3, 2008 may be the data types are not same? one could be a percent and other could be a number? Link to comment Share on other sites More sharing options...
CaptnTony Posted December 3, 2008 Share Posted December 3, 2008 I'd probably have to look at the two reports a bit more to see how the variables are defined and returned etc. Might want to post them here so someone can take a look at them. Link to comment Share on other sites More sharing options...
gellie Posted December 4, 2008 Author Share Posted December 4, 2008 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 sothx Link to comment Share on other sites More sharing options...
CaptnTony Posted December 4, 2008 Share Posted December 4, 2008 do you truly want to be doing a SUM on the variable returned (calling the subreport multiple times). If so, are you returning the same value each time (ten times), by mistake? Link to comment Share on other sites More sharing options...
gellie Posted December 9, 2008 Author Share Posted December 9, 2008 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 More sharing options...
CaptnTony Posted December 9, 2008 Share Posted December 9, 2008 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now