John,

I see a couple of problems, here. 

First, the _expression_ needs to return a Boolean object, not a boolean primitive, so the first thing would be to change it like so:

(($F{JOB_PROFILE_TYPE} != "MERGE") ? Boolean.TRUE : Boolean.FALSE)

However, this still isn't quite right. That $F{JOB_PROFILE_TYPE} is going to be handled as a String object, and you can't compare the contents of two Strings in Java with [in]equality operators.  So you need to use the "equals()" method on that String, like this:

((!$F{JOB_PROFILE_TYPE}.equals("MERGE")) ? Boolean.TRUE : Boolean.FALSE)

However, if your variable can potentially be null, you need to build in one more check, to prevent a NullPointerException:

((($F{JOB_PROFILE_TYPE} == null) || (!$F{JOB_PROFILE_TYPE}.equals("MERGE"))) ? Boolean.TRUE : Boolean.FALSE)

Personally, I would shorten that a little bit, to end up with this _expression_:

(("MERGE".equals($F{JOB_PROFILE_TYPE})) ? Boolean.FALSE : Boolean.TRUE)

--
-dave

geek blog: http://spugbrap.blogspot.com
personal blog: http://spugbrap-personal.blogspot.com
family website: http://www.oatmealcookies.org
bookmarks: http://del.icio.us/spugbrap


On 6/6/06, John Dunn <[EMAIL PROTECTED]> wrote:
I need help with the syntax in returning a boolean.

Whay does this not wirk? I get a compilation error?


(($F{JOB_PROFILE_TYPE} != "MERGE") ? true : false)

John Dunn
Product Consultant
Direct Dial +44 (0) 117 373 6122
Sefas Innovation Ltd, CityPoint, Temple Gate, Bristol BS1 6PL, UK.
Tel: +44(0) 117 373 6114
Fax: +44 (0) 117 373 6115

www.sefas.com





_______________________________________________
jasperreports-questions mailing list
jasperreports-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasperreports-questions




_______________________________________________
jasperreports-questions mailing list
jasperreports-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasperreports-questions

Reply via email to