How to avoid null values in jasper reports

Sachin Anand picture Sachin Anand · Jul 5, 2010 · Viewed 96.3k times · Source

I have a field in my jasper report which has a expression value like

$F{address_street1}+" "+$F{address_street2}+ " " +$F{address_state} + " "+$F{address_country}+ " "+$F{address_zip}

My problem is that if any of the fields in here is null I get the null value between other things like

101 Main St****null****ILUnited States12345 

Notice the highlighted null. Is there any way I can avoid that?

I have tried checking the null value for a particular field in it using boolean expression and replacing it with blank, but that doesn't seem to work.

Answer

krock picture krock · Jul 5, 2010

Set the property isBlankWhenNull to true.

  • In iReport check the Blank When Null checkbox when your field is selected.
  • In jasper jrxml file: <textField isBlankWhenNull="true">