Reputation: 480
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
Any help will be appreciated
Upvotes: 3
Views: 21514
Reputation: 1477
You need to include jasperreports-functions in your build file. e.g: for gradle
implementation 'net.sf.jasperreports:jasperreports-functions:6.12.2'
Upvotes: 0
Reputation: 2774
Try using ternary
operator instead of IF
like below
"Some value" + (value == true ? "pippo" : "pluto")
Hope this would help you out.
Upvotes: 6