ireport中 根据表中栏位获得的值来判断显示不同数据。

来源:互联网 发布:偶像活动美月卡片淘宝 编辑:程序博客网 时间:2024/06/06 01:02

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  显示空事,可以按下图设置

0 0
原创粉丝点击