lucasleanna Posted March 12, 2014 Share Posted March 12, 2014 iReport version 4.0.2, I have a field that should only print when multiple other fields have certain values.$F{ONE}.equals("Yes") && $F{TWO}.equals("No") || $F{THREE}.equals("No") So ONE has to be Yes and TWO or THREE have to be no, and this field will print. I've tried multiple ways attempt to get it to work using : ? if-else and making Booleans, but nothing I've tried works. Help would be appreciated! Link to comment Share on other sites More sharing options...
jeffrey.hegeman Posted March 12, 2014 Share Posted March 12, 2014 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 : FALSEYou might need to nest multiple ternarystatements like ... $F{ONE}.equals("Yes") ? $F{TWO}.equals("No") ? $F{TWO}.equals("No") ? TRUE : FALSEI don't think my syntax is 100% right, especially on the nested example, but this should point you in the right direction. Link to comment Share on other sites More sharing options...
lucasleanna Posted March 12, 2014 Author Share Posted March 12, 2014 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! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now