cancel
Showing results for 
Search instead for 
Did you mean: 

using ranges in an "in" expression

Former Member
0 Kudos

Hi,

CRv14

Having quite fun trying to search for an answer to a syntax question using "in"... 8^)

I have a report that checks zip code fields (of type character) and assigns a value to what county they're in.

The original list I got was just dumped into the formula and has worked fine in a pinch.  After a little research, I see that the zip list is pretty incomplete, so I'm looking to re-code based of postal SCF assumptions.  When I try to use ranges, it's telling me it expects a number, currency amount, blah, blah.

(abbreviated code)

if {@Zip} in //Bronx

['10453','10457','10460'] then 'Bronx'

else if {@Zip} in //Queens

['11361','11362'] then 'Queens'

changed to:

if {@Zip} in //Bronx

['10400' - '10499'] then 'Bronx'

else if {@Zip} in //Queens

['11004' - '11005', '11100' - '11199', '11300' - '11499', '11600' - '11699'] then 'Queens'

I'm having a hard time finding the syntax.  Tried a bunch of variations.  I will also need to use similar code in Record Selection so I suppose the solution can't rely on Basic syntax

Help.

Thanks,

Matt

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Matt,

Try:

if {@Zip} in //Bronx

['10400'  TO  '10499'] then 'Bronx'

else if {@Zip} in //Queens

['11004' TO '11005', '11100'  TO  '11199', '11300'  TO  '11499', '11600'  TO  '11699'] then 'Queens'

-Abhilash

Answers (1)

Answers (1)

Former Member
0 Kudos

Okay, my bad, I had tried that, but may have done some other typo that messed it up.

Works like a charm.

Thank you, Abhilash.