File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Java Products and Servers and the fly likes acumulative sum with ireport Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "acumulative sum with ireport" Watch "acumulative sum with ireport" New topic
Author

acumulative sum with ireport

jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93
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

Joined: May 13, 2010
Posts: 93
I solved the problem!!! Thanks...
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

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


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


apigee, a better way to API!
jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: acumulative sum with ireport
 
Similar Threads
static method
getting column names from JDBC and display it in JTree
SQL error:Invalid identifier
Date Calculations - Difference between 2 dates is off
Question on Pass By Reference