文本字段值中的Jasper Report IF条件 [英] Jasper Report IF condition in Text Field Value

查看:510
本文介绍了文本字段值中的Jasper Report IF条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用文本字段值编辑器,我将文本添加有条件的文本(请注意,if是使用JasperSoft studio的字段编辑器构造的,因此代码IF(...)是自动生成的,我只给出了值"pippo"和"pluto")

Using text field value editor i add a text to the text field with a condition (note the if is constructed using the field editor of JasperSoft studio so the code IF(...) is autogenerated, i gave only the value "pippo" and "pluto")

"Some value" +IF(true,"pippo","pluto")

但是似乎不起作用.从我的代码调用报告时出现此错误:

But it seems it don't work. I'm getting this error during calling the report from my code:

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. The method IF(boolean, String, String) is undefined for the type 

任何帮助将不胜感激

推荐答案

尝试使用ternary运算符代替如下所示的IF

Try using ternary operator instead of IF like below

"Some value" + (value == true ? "pippo" : "pluto")

希望这对您有所帮助.

这篇关于文本字段值中的Jasper Report IF条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆