Sql – Print When Expression in iReport comparing 2 string

ireportjasper-reportssql

Can I put more than one condition at print when expression? And can you please give the syntax. For example,

If Field Value = 'Cancelled' then Print Grey Color
Feild Value = 'Proposed ' then Print Black Color

Etc

Based on the Field value, I need to change the color of the text field.

I used this syntax

$F{status_Current}.StringValue() ='Canceled'? Boolean.TRUE : Boolean.FALSE

But it's throwing an Error.

Can someone please give the proper syntax for this

Best Answer

Assuming that the variable status_Current is of type string you should be able to compare using

$F{status_Current}.equals("Canceled")? Boolean.TRUE : Boolean.FALSE

But it sounds like you may be trying to do some conditional formatting which I haven't had to do yet. I researched a bit and found this question hope it helps.

Good luck!!!