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

When summing a variable I am only getting the last value of the variable.


amartin_2

Recommended Posts

I have a variable that performs some math on some database fields.

 ($F{Price}.doubleValue()/$F{Price Qty}.doubleValue())*$F{Qty Sold} 

(($F{Reg Retail}.doubleValue()/$F{Reg Retail Unit}.doubleValue())-($F{Price}.doubleValue()/$F{Price Qty}.doubleValue()))*$F{Qty Sold}

These variables perform perfectly and give me the values I need.  The first tells me the price per unit of an item and multiplies it against the total sold to give me total sales for the unit.  The second gives me the difference between the regular price and the discounted price and multiplies it against total sold to give me the markdown amount, or the amount the sale cost me.  

My problem occurs when I try to sum these variables in the Group Footers.  I drag the variable into the footer and when the report runs it only shows me the last value of the calculation, but if I drag a field into the Group Footer band it asks me if I want to sum, count, etc. the field and the fields will sum properly.  I am running into the same problem when I try to put a variable I have created into a crosstab.  If I put fields from the database in the crosstab they calculate just fine but when I put variables I have created in Jaspersoft Studio that work correctly in the body of the report, the numbers come out all screwy.  Anyone know what I am doing wrong?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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