Testing for a group of values

Tony Marston - 4th January 2002

There may be some times when you need to test for multiple values within a field or variable. This can be done using code such as the following:-

If (NAME = "ALF" | NAME = "BILL" | NAME = "CHAS" | NAME = "DAVE")
   .....

Note here that the item name is duplicated for each possible value.

A shorthand way of achieving the same result is to make use of the UNIFACE syntax string, as in the following:-

If (NAME = '(ALF)(BILL)(CHAS)(DAVE)') & (NAME != "")
   .....

Note the additional test & (NAME != "") at the end. Without this a null value would also be treated as TRUE.


Tony Marston
4th January 2002

mailto:tony@tonymarston.net
mailto:TonyMarston@hotmail.com
http://www.tonymarston.net

counter