Jump to content
Changes to the Jaspersoft community edition download ×

Problem summing multi subreport values


2005 IR Help

Recommended Posts

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>

Link to comment
Share on other sites

  • 2 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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