Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

if-else-if-else in textfield expression [duplicate]

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 ?

like image 474
Tito Avatar asked Jan 13 '11 07:01

Tito


1 Answers

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

For example:

(i == 1) ? "Send" : ((i == 2)? "Received" : "Cancelled");
like image 163
Gordon Avatar answered Oct 28 '22 04:10

Gordon