if result == true,should "OK" written

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.


i am using iReport Dedigner and trying to make a Crosstab. If have a boolean variable on my table. It will be shown just true or false. but i want to see "ok" if it is true, and "not ok" if it is false. How can i do that?

sorry, but i am a beginner :)



emrah.karakoc's picture
Joined: Feb 22 2013 - 1:42am
Last seen: 8 years 6 months ago

1 Answer:

You may be able to use a ternary (? :) operator for that.  It would be something like:

$V{bool_var} == Boolean.TRUE ? "ok" : "not ok"

The only problem with this is that it will evaluate to "not ok" for any value other than true.  So, for example if there is no value for the variable at all, it will evaluate to "not ok".  This may work in your case though.



kcollins's picture
Joined: Aug 30 2011 - 12:22pm
Last seen: 1 year 11 months ago

but i want to have it blank if there is no value? wouldnt "blank if null" help me in this case?
or that i can put a third condition to $V{bool_var} == Boolean.TRUE ? "ok" : "not ok"? :)
Thanks your answer

emrah.karakoc - 9 years 4 months ago

Blank if null will not help you here since you have the ternary expresion there so it will always be a value, you will either render "OK" or "not ok".
For using the blank if null you will need to add a second expresion that checks for the actual false value and if is neither true or false will just print the value

Something like:
$V{bool_var} == Boolean.TRUE ?
: (
$V{bool_var} == Boolean.FALSE ?
"Not ok"

marianol - 9 years 4 months ago

but i have already a print when expression, which is "$V{serverUrl} != null" ? how can i combinate it with "ok" and "not ok" expression?

emrah.karakoc - 9 years 4 months ago