Problem summing multi subreport values

By: Jack Lavallet - jlavallet
Problem summing multi subreport values
2004-07-15 20:31
Hi. I am using a subreport to calculate the summation of a field's values. This sum is passed to the master report using the 'tips and tricks' technique. I have verified that the subreport sum is correctly calculated and returned to the master report. The subreport is in my detail band and is run several times within the same group. I am attempting to use a variable to sum these returned sums in the master report. Here is my variable definition:

<pre>
<variable name="FunctionTotal" class="java.lang.Double" resetType="Group" resetGroup="FunctionGroup" calculation="Sum">
<variableExpression><![CDATA[$P{SubreportFunctionTotalMap}.get("SubreportFunctionTotal")]]></variableExpression>
<initialValueExpression><![CDATA[new Double(0.00d)]]></initialValueExpression>
</variable>
</pre>

Question: how can I get the subreport sum to be returned with each detail pass? It is currently evaluated after the group is completed.

Question: how do I define a variable to sum each returned subreport sum for use in a textfield in the group footer.

My report looks like this:

<pre>
Group Header
Detail Band Start
Subreport Start (subreport repeated for each
subreport datasource tuple)
Line 1 10
Line 2 20
Line 3 10
Subreport End (here's where I want to set my
master report var to sum the
value returned by the subreport)
Detal Band End
Column Footer Start
Total 40 (the sum of the subreport sums)
Column Footer End
</pre>

Thanks for your help!
Jack
<pre>
2005 IR Help's picture
Joined: Aug 9 2006 - 3:40am
Last seen: 17 years 1 month ago

1 Answer:

Do you ever get answer of your question? I am facing the similar problem and would like to figure out if there is a way to resolve it? I am in the verge of giving up on the iReport as solution due to this problem?

Please help!
eagle101's picture
Joined: Nov 1 2006 - 5:19am
Last seen: 16 years 11 months ago
Feedback