Jump to content
We've recently updated our Privacy Statement, available here ×

Multiple IF-ELSE


PP Ocean
Go to solution Solved by jgust,

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

In Jasper the supported java IF statement is called a Java Ternary Operator.

Here is the format:      (expression) ? value if true: value if false

Example:

$F{Column1}.equals( "A" ) ? "Text 1"    : $F{Column2}.equals( "B" ) ? "Text 2"    : $F{Column3}[/code]

In case your ternary gets more complicated here is a link to an article on Java basic operators.  This will be helpful if you need to add an AND (&&) or and OR (||) condition.

https://www.tutorialspoint.com/java/java_basic_operators.htm

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...