ireport 中没有 if else 写法但 有 ?: 运算符。
如 以下 if else 语句
if {CLASS}="0" then
"中国出口"
else if {CLASS}="1" then
"香港进口"
else if {CLASS}="2" then
"退料"
else if {CLASS}="3" then
"转余料进口"
else if {CLASS}="4" then
"转余料出口"
else if {CLASS}="5" then
"转厂进口"
else if {CLASS}="6" then
"转厂出口"
else if {CLASS}="7" then
"内销"
else if {CLASS}="8" then
"其它"
等价于
$F{CLASS}.equals("0")?"中国出口":
$F{CLASS}.equals("1")?"香港进口":
$F{CLASS}.equals("2")?"退料":
$F{CLASS}.equals("3")?"转余料进口":
$F{CLASS}.equals("4")?"转余料出口":
$F{CLASS}.equals("5")?"转厂进口":
$F{CLASS}.equals("6")?"转厂出口":
$F{CLASS}.equals("7")?"内销":"其它"
当 获得的值为 null 显示空事,可以按下图设置
在 iReport 设计报告时,由于没有传统的 if-else 语句,可以利用 ?: 运算符根据表中字段的值来决定显示不同的数据。这种运算符提供了条件判断的功能,使得在报表设计中实现动态内容展示成为可能。
2695

被折叠的 条评论
为什么被折叠?



