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

NULL Calculation ?


runner1549

Recommended Posts

How can I get the below to work when one value is null ?

-------------------------------------------------------------------------------------

Example

 1. COMP_PERC_1 = 10

 2. CAT_PERC_1 = NULL

 3. below display NULL, but should really display "10"

             new Double($V{COMP_PERC_1}.doubleValue() + $V{CAT_PERC_1}.doubleValue())

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Try adding a null condition to the output... in the case below the Field element will print the value of the COMP varable in case of CAT_PERC_1 == null

$V{CAT_PERC_1}==null? new Double($V{COMP_PERC_1}.doubleValue()): new Double($V{COMP_PERC_1}.doubleValue() + $V{CAT_PERC_1}.doubleValue())

Luck!

Code:
$V{CAT_PERC_1}==null? new Double($V{COMP_PERC_1}.doubleValue()): new Double($V{COMP_PERC_1}.doubleValue() + $V{CAT_PERC_1}.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...