Print when expression problems

I'll start out by saying that I'm brand new to iReport.  The lack of documentation has been frustrating to say the least.  So far I've found very useful answers here in the forums.  So now here's my question...

I am creating a new report that needs a "stoplight".  I have a field on my database that has a text representation of the status (Red, Green, Yellow).  I have created three rectangles and in the Print when expression box have put the following:

new Boolean($F{fieldname} == "Red")   /* or green or yellow

The report compiles great and generates, but the rectangle doesn't display when it should.  Ok it nevers displays.  The field is a varchar and the database is Oracle.   I know that the data is "Red" because I've interrogated it using a few other tools.

Any pointers would be greatly appreciated!

cgnewman's picture
Joined: Sep 11 2008 - 12:54pm
Last seen: 15 years 3 weeks ago

3 Answers:

try using

new java.lang.Boolean ($F{FIELDNAME}.equals(new java.lang.String("Red")))

or

new java.lang.Boolean ($F{FIELDNAME}.equals("Red"))

 

let me know if it's ok

marcosamba's picture
Joined: Sep 28 2006 - 7:10pm
Last seen: 10 years 10 months ago

That worked perfectly!  Thanks so much!

cgnewman's picture
Joined: Sep 11 2008 - 12:54pm
Last seen: 15 years 3 weeks ago

Documentation is available check to post pinned at the top of the forum.

svenn's picture
15200
Joined: Mar 19 2007 - 5:57am
Last seen: 16 years 6 months ago
Feedback
randomness