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

"where-function" in sum of a variable


jhhenkel

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Sure. Define a variable called SumX with data type java.lang.Integer (or whichever data tyep is appropriate for summing FIELD1), set the calculation to "Sum", leave Reset type at "Report", set the Initial Value Expression to 0, and set the Variable Expression to attribut1 == x ? $F{FIELD1} : 0

If you drag a copy of this variable into your summary band, it will show you the sum of the FIELD1 values for every detail band where attribute1==x (except that I don't really know what attribut1 is...I presume it's really a condition, not an attribute, and you'll replace that with some condition like $F{Status}=="Open")

 

Then in the Report inspector, copy variable SumX and paste it so you have a new variable with exactly the same properties but a different name. In the properties pane, rename the variable to SumY and change the Variable Expression so it has the desired condition at the beginning ($F{Status}=="Closed", or something like that).

 

Hope that helps!

 

Carl

Link to comment
Share on other sites

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