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

iReport 5.6, Fishbowl Inventory and Math Problems


rasinc

Recommended Posts

I have an inventory-type report grouped by PartId.  There is a total of the QtyToFulfill column for each group.

I want to subtract the total of the QtyToFulfill (BigDecimal) from the QtyOnHand (Double) field.

I've tried

$F{QTYONHAND}.subtract($V{qtyToFulfill_1})

and 

$F{QTYONHAND}.subtract($V{qtyToFulfill_1}.DoubleValue())

I am sure it has to do with the datatype but I don't know the correct syntax.

Can someone give me a hand figuring this out?

TIA rasinc.

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Thanks for the reply.  I added the formula to the Variable Expression and double-checked that I had set everything to BigDecimal and now I get the error

The method valueOf(long, int) in the type BigDecimal is not applicable for the arguments (BigDecimal)

The express is

$F{QTYONHAND}.subtract(BigDecimal.valueOf($V{qtyToFulfill_1}))

and put the variable in the group footer.  QTYONHAND is showing as a double in the field list in the expression editor.  Any ideas what else I can try?

Link to comment
Share on other sites

In your variable have the Value Class Name set to java.math.BigDecimal and try putting the same infront of your $F{QTYONHAND}.

BigDecimal.valueOf($F{QTYONHAND}).subtract(BigDecimal.valueOf($V{qtyToFulfill_1})).

Keep your field class for $F{QTYONHAND} as java.math.BigDecimal and your variable class for $V{qtyToFulfill_1} as java.lang.Double.

Only change the class in your calculation variable. Hopefully that helps you out

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