skrpc Posted August 16, 2011 Share Posted August 16, 2011 I have had this issue in versions of JasperReports for as long as I can remember (I am now using 4.1.1).The groovy statement$F{duration} == null ? 0 : $F{duration}does not seem to work, the output of the text field is the word "null", the field value is null because if I select the option Blank when Null the output is indeed blank.Seems a basic test but have found that it only seems to work for string values, any numeric based value cannot be tested for null and the output defaulted to another value. For example test if a field is null in the database and output No otherwise output "Yes" so you would assume the statement$F{intval} == null ? "No" : "Yes"would be ok but no, when the field in the database has a null value the output is "null" and not "No"Comments ?? Link to comment Share on other sites More sharing options...
szaharia Posted August 22, 2011 Share Posted August 22, 2011 Hi,See the workaround here.HTH,sanda Link to comment Share on other sites More sharing options...
rodney.rear Posted January 5, 2015 Share Posted January 5, 2015 Just ran into this myself. Any formula involving a null number seems to error out as null.My workaround is to evaluate the possibly null field into a variable first, then check the variable for null. Link to comment Share on other sites More sharing options...
Areport Posted March 31, 2015 Share Posted March 31, 2015 Same issue here. Probably again a groovy problem? 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