I want to do a comparison such as:
if <field> == 0 then "-"
Can somebody tell me the syntax using JasperReports?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
iReport (JasperReports) uses a Ternary operator. For example, consider the following logic:
Using a ternary operator, this becomes:
When using a variable with the following expression:
Then the variable’s value would be “Life, Universe, Everything” if, and only if, the integer value of
$F{column_value}is equal to 42.Where things get a little obtuse is when you have to have nested conditions. For these, put the nested conditions in parenthesis and on a separate line:
So when you need to do many of them: