Jump to content
Changes to the Jaspersoft community edition download ×

How to sum BigDecimal values


kunkasurendra

Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

The API is good if you want to do precision mathematics, but let me give you an easier answer.

You can't add two BigDecimals together because that would be crashing two objects into each other, essentially. :-)

Your best bet is to take the .doubleValue() of each and add those together, since that method returns a primitive type that you can do arithmetic on.

Code:
$F{MYDECIMAL1}.doubleValue() + $F{MYDECIMAL2}.doubleValue()
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...