Jump to content
We've recently updated our Privacy Statement, available here ×

using variables to calculate subtotals


2005 IR Help

Recommended Posts

By: Alceu Rodrigues de Freitas Jr. - glasswalk3r

using variables to calculate subtotals

2005-05-30 08:27

Hello,

 

I have a report that should show data like the example

below:

 

Group 1

----

Amount Unit value Total Value

-------------------------------

3 10 30

4 10 40

Subtotal: 70

 

Group 2

Amount Unit value Total Value

-------------------------------

4 10 40

5 10 50

Subtotal: 90

 

The problem is that I inserted all the data in the

"Detail" group, including the "Subtotal" line. I used

a variable to calculate the subtotal:

 

Variable name: subtotal

Reset Type: Report

Calculation Type: Sum

Variable Expression: $F{total_value}

Initial Value Expression: new Double(0)

 

The variable is not being "reseted" to zero as I would

like. I tried to use another types of "Reset Type" but

it is not working.

 

Everytime I execute the report, I get the first

"Subtotal" ok, but the next one will be the previous

value plus the next values. The final result is this:

 

Group 1

----

Amount Unit value Total Value

-------------------------------

3 10 30

4 10 40

Subtotal: 70

 

Group 2

----

Amount Unit value Total Value

-------------------------------

4 10 40

5 10 50

Subtotal: 160

 

 

There is any way to implement that in iReport? How

should I do it?

 

Thanks in advance

 

 

 

 

By: Giulio Toffoli - gt78

RE: using variables to calculate subtotals

2005-05-31 00:43

 

ResetType: Group

ResetGroup: Your group name

 

Giulio

 

 

 

 

By: GSantos - gureba

RE: using variables to calculate subtotals

2006-03-28 13:15

How to calculate a percentage of each detail in a subtotal, and the similar of each subtotal, example:

 

Product Qty Part%

A 25 83,3%

B 5 16,7%

SubTotal 30 33,3%

 

C 30 50,0%

D 30 50,0%

SubTotal 60 66,7%

 

Total 90

 

How can we implement this calculation? We tried to use different variables, with different evaluation times, but it didn´t works.

 

Thanks,

Gustavo Santos

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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