Win a copy of Event Streams in Action this week in the Java in General forum!
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Devaka Cooray
• Liutauras Vilda
• Jeanne Boyarsky
• Bear Bibeault
Sheriffs:
• Paul Clapham
• Knute Snortum
• Rob Spoor
Saloon Keepers:
• Tim Moores
• Ron McLeod
• Piet Souris
• Stephan van Hulst
• Carey Brown
Bartenders:
• Tim Holloway
• Frits Walraven
• Ganesh Patekar

# acumulative sum with ireport

Ranch Hand
Posts: 98
Hi everybody
I need to do a sum acumulative in a column of my report. I retrieve a value from the database and I fill the other columns with some mathematical operation with this value.
The last column must be the sum and in every row it must to sum the above value also: For example;

How Can i do that? I dont find the way. I had tried some variablesand things similar to : \$V{var1}= \$V{var1}+\$V{TOC} and i get errors.!
I using Ireport 4.0.
Please let me know if that is possible in ireport?
Thanks

jhon masco
Ranch Hand
Posts: 98
I solved the problem!!! Thanks...

Bartender
Posts: 1638
• 1

jhon masco wrote: I solved the problem!!! Thanks...

It will be great if you can also give us the solution.

jhon masco
Ranch Hand
Posts: 98

It will be great if you can also give us the solution

You are right sorry!

Note: my main language is not english and I dont live there, therefore i will try to write everything correctly
Here the solution:
create a variable for each operation or formula, is to say:
Variable1 = (2000/2) or (DATADB/2)
Variable2 = (2000 *60)/365 or ((DATADB*60)/365)
Variable3 = (Variable1 + Variable2)
Variable4 = (Variable3)

them in the Variable4 properties set:
Variable Class = java.lang.double
Calculation = Sum
Reset Type = Column or Page or Report (depend you case)
Increment type = Group
Increment Group = (choose the group that you created before, when you use the wizard for example you create a group)
Variable Expression = (\$P{Variable3}>0) ? \$P{Variable3}: 0

And ready, that is all.
Any doubt let me know
Suerte

 With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.