if-else-if-else在textfield表达式中 [英] if-else-if-else in textfield expression
本文介绍了if-else-if-else在textfield表达式中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须显示列:
- 发送
- 接收
- 已取消
在报表列中,通过检查值从DB是状态。所以如果状态等于1,那么发送,= 2接收,= 3被取消。
jasper报告(?a:b)中的textfield表达式只能取一个条件我有多重条件吗?
解决方案
你可以使用嵌套的三元语句来实现这一点,但是它很混乱。
例如:
(i == 1)? 发送:((i == 2)?Received:Cancelled);
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 ?
解决方案
You can use a nested ternary statement to achieve this but it's messy.
For example:
(i == 1) ? "Send" : ((i == 2)? "Received" : "Cancelled");
这篇关于if-else-if-else在textfield表达式中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文