Alex Rivera | Logout

if-else-if-else in textfield expression

Asked 2011-01-13T07:17:49.837
16

I have to show columns: - send - receive - cancelled

In a report column by checking a value from DB which is "Status". So if Status equals 1 then send,=2 receive , = 3 cancelled.

The textfield expression in jasper report ( ? a:b) can only take one condition, how do i give multiple conditions ? something like if-else ladder ?

Edit
Report

1 Answer

28

You can use a nested ternary statement to achieve this but it's messy.

For example:

(i == 1) ? "Send" : ((i == 2)? "Received" : "Cancelled");
answered 2011-01-13T11:44:23.467

Your Answer