Jump to content
Changes to the Jaspersoft community edition download ×

conditional field display

2006 IR Open Dicussion

Recommended Posts

By: Nick - nick_nz

conditional field display

2006-02-27 12:38

I have a simple report - a phone list - where people have several phone numbers. I want to display the mobile number if present, otherwise display the land line. These are two seperate fields in the DB. What is the best way to do this?





By: Josh - wildbrows

RE: conditional field display

2006-02-27 13:14

You will want to use the java ?: operator. For the usage, see here: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/other.html


Basically, you will want your variable or textfield expression to look something like this:


$F{mobile_number} == null ? $F{land_line} : $F{mobile_number}


That basically says if the mobile number field is null, then return the land line field, otherwise return the mobile number field

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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...