steven.cyc Posted November 28, 2012 Share Posted November 28, 2012 Hi, I'm new to iReport, and working in the version of iReport 4.0. I have a field expression to handle the null field as below: $F{Profit} == null ? "N/A": new DecimalFormat("#,##0.00").format($F{Profit} the field is expected to display "N/A" if null value, but iReport cannot validate the null value, it displays EMPTY. I have checked that the "Blank When Null" is enabled, so I have already unchecked it.. but the report diaply "null" finally, not "N/A" is it a bug of iReport ? could you have any suggestion? I'm using Groovy, because the standard of our project is using Groovy. Please Help.. Link to comment Share on other sites More sharing options...
sanbez Posted November 28, 2012 Share Posted November 28, 2012 Check this report in your environment. In my case it's worked perfect (JR 4.8.0)<?xml version="1.0" encoding="UTF-8"?> select 1.12 Profit, 'not null field' descr from dualunion all select null, 'null field' from dual PROFIT DESCR $F{PROFIT} == null ? "N/A" : new DecimalFormat("#,##0.00").format($F{PROFIT}) $F{DESCR} Link to comment Share on other sites More sharing options...
sanbez Posted November 28, 2012 Share Posted November 28, 2012 <?xml version="1.0" encoding="UTF-8"?> select 1.12 Profit, 'not null field' descr from dual</p><p> union all select null, 'null field' from dual PROFIT DESCR $F{PROFIT} == null ? "N/A" : new DecimalFormat("#,##0.00").format($F{PROFIT}) $F{DESCR} 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