iReport version 4.0.2, I have a field that should only print when multiple other fields have certain values.
1 Answer:
Ternary statments. The format will mimic the following syntax, however within your report you would want to omit the semicolon at the end of the statement.
[Condition] ? [value if true] : [value if false] ;
You might be able to do what you want with one ternarystatement like ...
$F{ONE}.equals("Yes") && ($F{TWO}.equals("No") || $F{THREE}.equals("No")) ? TRUE : FALSE
You might need to nest multiple ternarystatements like ...
$F{ONE}.equals("Yes") ? $F{TWO}.equals("No") ? $F{TWO}.equals("No") ? TRUE : FALSE
I don't think my syntax is 100% right, especially on the nested example, but this should point you in the right direction.
Thank you :) The first one with just one statement, I tried and it didn't work. Second one, yes the syntax looks iffy...but it's somewhere new to start!