Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid null values in jasper reports

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.

like image 249
Sachin Anand Avatar asked Jul 05 '10 05:07

Sachin Anand


People also ask

Is blank when null Jasper?

If the "Blank when null" is checked and its contains static text inside the text field the database fields ($F{}) will return null (if the field has no value).

How do I change the number format in Jasper report?

The best way to format in jasper report is to use the pattern attribute on the textField tag. This will keep correct class (Number), when exporting to for example excel, excel can identify it as number and will also apply same pattern.


1 Answers

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">
like image 117
krock Avatar answered Sep 21 '22 21:09

krock