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

print when expression


sedcal

Recommended Posts

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'))
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic


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

Author, JasperReports 3.6 Development Cookbook

Link to comment
Share on other sites

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