Jump to content
Changes to the Jaspersoft community edition download ×

subreport return value summations in groups


Recommended Posts

I am attempting to sum returned values in a Map from a subreport. I can get the value returned at the detail level, and get each corresponding value within the subreport displayed, but I need to sum them. When I attempt to put the value from the Map into a variable with sum as the calculation, it seems to be a step behind.




$V{returnMap}.get("totals") displays as 10


Variable set to the value of the retunr map with sum displays initially as null


next returnmap:

$V{returnMap}.get("totals") displays as 12


variable now shows 10


next returnmap:

$V{returnMap}.get("totals") displays as 15


variable now shows 22



...and so on - I need that first variable to show as 10, then the proper sums following


I am displaying the variable(s) in group bands, evaluating at group level for the corresponding band.




Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

okay - reworking this.


I get a map from a crosstab returned to a subreport, in turn sending that value to a main report.


The problem:


If I show the value from the map in a Text field, no problem - I can see it. However, I need to get that value into the main report - ie using a return variable. I need to sum these return variables on the main page in groups on the main report (which is why just forwarding the map does not solve my problem)


So - when I try to populate a vairabel the same way the text field is populated, I get 0 - always.


Here's the code:






when I get the map into a text field:


<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Band" hyperlinkType="None" hyperlinkTarget="Self" >
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{crossTabRowCountMap}.get("totals"«»)]]></textFieldExpression>



When I try to get the values from the map into a variable:


<variable name="districtTotalYes" class="java.lang.Integer" resetType="Group" resetGroup="District" calculation="System">
<initialValueExpression><![CDATA[new java.lang.Integer(0)]]></initialValueExpression>

Putting the above into a text field gives me 0.




Post edited by: rcmpjames, at: 2007/05/24 16:48

Post edited by: rcmpjames, at: 2007/05/24 16:49

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