If Else In Expression Editor

Good Day All,

can anybody help me on this. I try to make an if else expression  ($F{OUT_STATUS} .equals("40") ? "Applied": "Failed" ). Main main pioint is if the Out_status data is 40 it will show Applied and other than that are failed. however when i run my report it just show Failed for all data. Note that the Out_status datatype is int and i also have try to chage it to ($F{OUT_STATUS} .equals(40) ? "Applied": "Failed" ) but the result are same.  Its my first time using jasper. Before this im a crystal developer.


Thank You


Best Regards

railey.shah's picture
Joined: Nov 18 2012 - 7:43pm
Last seen: 10 years 2 weeks ago

1 Answer:

If your field is type of Integer you should use an Integer expression instead:

$F{OUT_STATUS}.intValue() == 40?"Applied":"Failed"


Be sure that your field is not null, otherwise use this:

$F{OUT_STATUS} == null || $F{OUT_STATUS}.intValue() != 40?"Failed":"Applied"


hth + regards from Germany


C-Box's picture
Joined: Jul 19 2006 - 5:58pm
Last seen: 3 months 1 week ago

Thank You sir, It really help me.

railey.shah - 10 years 2 weeks ago

Good evening!

What aboot if the field from the database is a boolean?

Thank you

rosamarozzi - 7 years 3 months ago

Boolean.TRUE.equals($F{YourBoolField}) ?"Write Static YES as its just true": "Write Static NO as its null or false"


C-Box - 7 years 3 months ago