Jump to content
Changes to the Jaspersoft community edition download ×

using ternary operator for two fields


Recommended Posts

I'm trying to get two date ranges to show up with the word "AND" in the middle of it if both fields are not null. I can't have the end date showing up with the "and" if the beginning date is null. I've tried a few things.

Here's one:
($P{p_trip_entry_begin} != null) ? $P{p_trip_entry_begin} : ($P{p_trip_entry_end} != null) ? ($P{p_trip_entry_begin} != null + " AND " + $P{p_trip_entry_end} != null) : ""

Another one I tried was doing a print when express on the text field of " AND " when the end date is not null, but i'm not sure if there is a way to tell it to print the AND if BOTH are not null.. is there a way?

Link to comment
Share on other sites

  • 1 month later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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