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