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

Adding 2 BigDecimals in a variable


grototo

Recommended Posts

Hi folks, first of all, all apologies for my english. I'll try to to my best....

Here is my issue : in a subreport, I want a variable to take the value, which is the sum of 2 BigDecimals.

The problem is Jasper doesn't even insult me when I write this :

Variable Total : $F{montantFraisRejetPacs004}.add( $F{montantFraisIndemnite} )

The problem is that either montantFraisInitial or montantFraisComplementaire can be null.

I've tried something like : ($F{montantFraisIndemnite} == null ? $F{montantFraisRejetPacs004} : $F{montantFraisRejetPacs004}.add($F{montantFraisIndemnite}))
||
($F{montantFraisRejetPacs004} == null ? $F{montantFraisIndemnite} : $F{montantFraisRejetPacs004}.add($F{montantFraisIndemnite}))

in the variable expression from the subreport, but of course,  the operator || is undefined for my argument types BigDecimal, BigDecimal.

 

Does anyone have a solution to this, please?

Thanks a lot, and best regards.

Thomas

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Ok I solved it :

 

(($F{montantFraisIndemnite} != null && $F{montantFraisRejetPacs004} != null) ? $F{montantFraisRejetPacs004}.add($F{montantFraisIndemnite}) : ($F{montantFraisIndemnite} == null ? $F{montantFraisRejetPacs004} : $F{montantFraisIndemnite}) )

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