jasper reports - Why do I have error in the expression editor when I sum BigDecimal in Jaspersoft Studio? -


i want sum 2 bigdecimal, before need know values not null (i made check java side, want try jasper side).

so, check:

($f{a} != null ? $f{a} : new bigdecimal(0)) ($f{b} != null ? $f{b} : new bigdecimal(0)) 

now, have sum a , b, if do:

($f{a} != null ? $f{a} : new bigdecimal(0)).add($f{b} != null ? $f{b} : new bigdecimal(0)) 

i get:

the current expression not valid. please verify it!

how can solve?

assuming fields both of class java.math.bigdecimal , using language="java" or language="groovy"

there nothing wrong expression!

don't worry expression editor simple can not understand ($f{a} != null ? $f{a} : new bigdecimal(0)) java.math.bigdecimal, why states "the current expression not valid. please verify it!" , show's red dot @ .add.

just press "ok" , enjoy result!

if simplify expression's or remove error in expression editor, can use variables.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -