sedcal Posted September 6, 2010 Share Posted September 6, 2010 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 exampleHow could I do that?Regards, Code:new Boolean($F{BATTERY_LIFE_LOW}.equals('0')) Link to comment Share on other sites More sharing options...
svenn Posted September 7, 2010 Share Posted September 7, 2010 You could place a static field or text field in the same position as your image with it's own print when expression. It would print out when your result is not "0". Link to comment Share on other sites More sharing options...
bsiddiqui Posted September 12, 2010 Share Posted September 12, 2010 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,bsiddiquiAuthor, JasperReports 3.6 Development Cookbook 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