使用文本字段值编辑器,我将文本添加到带有条件的文本字段(注意 if 是使用 JasperSoft studio 的字段编辑器构建的,因此代码 IF(...) 是自动生成的,我只给出了值“皮波”和“冥王星”)
"Some value" +IF(true,"pippo","pluto")
但是好像不行。从我的代码调用报告时出现此错误:
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
如下所示
"Some value" + (value == true ? "pippo" : "pluto")
希望对您有所帮助。
关于jasper-reports - 文本字段值中的 Jasper 报告 IF 条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42247300/