• Post Reply Bookmark Topic Watch Topic
  • New Topic
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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

acumulative sum with ireport

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solved the problem!!! Thanks...
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
This tiny ad is suggesting that maybe she should go play in traffic.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic