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

Null check fails


skrpc

Recommended Posts

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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 years later...
  • 2 months later...

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