hi all,

I have a report which includes the image and this image can be printed when the expression result is '0'

I would like to do that when the expression isn't '0', I want an answer instead of image, 'no info' for example

How could I do that?

Regards,

Code: |

`new Boolean($F{BATTERY_LIFE_LOW}.equals('0'))</td></tr></tbody></table>` |

## 2 Answers:

Yes, svenn is right. Whenever you want to display **one **of the two fields (e.g. either an image or some text), you can use the **Print When Expression **property in such a way that it will always be **true for one of the two fields and false for the other**.

I demonstrated exactly how to do this in one of the recipes of my JasperReports Cookbook. Please see recipe titled **Applying styles to your data based on a logical or mathematical condition** of chapter 9 **Using Mathematical and Logical Expressions** (available for free download, just click here). Especially see steps 13 and 15 of the recipe.

The **Print When Expression** property is very useful and can be used in many interesting and creative ways, together with the flexibility of mathematical and logical expressions that JasperReports offers. Chapter 9 demonstrates several ways of using the **Print When Expression** property.

Cheers,

bsiddiqui