Jump to content

Does string contain any of a list of values?


scottmacpherson

Recommended Posts

Hi all.

I'm struggling this one. I want to find out if a field equals any of a list of values. Hard to explain, but I basically want to do an SQL IN type query, but in a report expression.

I've tried using:

Code:
$F{Field}.matches("(bananas|apples|oranges)"«»)

with no sucess. In the above example, I want TRUE to be returned if the Field contained either 'bananas', 'apples' or 'oranges', but not anything else.

I also fiddled with the syntax of the above, but even something like:

Code:
[code]$F{Field}.matches("^(bananas|apples|oranges)$"«»)

doesn't work.

Any ideas on how to achieve this, or pointers as to where I'm going wrong with .matches?

Thanks.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

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