runner1549 Posted September 23, 2009 Share Posted September 23, 2009 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 More sharing options...
walmillard Posted September 24, 2009 Share Posted September 24, 2009 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 More sharing options...
runner1549 Posted September 24, 2009 Author Share Posted September 24, 2009 Thanks, below worked new Double(($V{COMP_PERC_1}!=null?$V{COMP_PERC_1}.doubleValue():0)+ ($V{CAT_PERC_1}!=null?$V{CAT_PERC_1}.doubleValue():0))[/code] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now