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

Image displayed based on boolean value returned by query


advait75

Recommended Posts

Hi,

I am a complete newbie. I wanted to know if in iReports it is possible to do something like, if a query returns a certain value(boolean) I can show one image and if another boolean value is returned, I can show another image.

E.g. If the query returns Y, a green arrow is shown and if the query returns N, a red arrow is shown

If yes, can someone point me to a tutorial or give me some pointers?

Thanks in advance.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hello,

You can use the field "Image Expression", when you insert an image object. Using that field, you can insert Java code.

You could do something like this:

($P{yourReadParameter} ? "green.jpg" : "red.jpeg")

or

($P{yourReadParameter}.equalsIgnoreCase("y") ? "green.jpeg" : "red.jpeg")

(Using that way, the expression class remains java.lang.String)

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