#INARRAY
Returns 1 if it finds the specified value(s) in an array, otherwise returns 0. #INARRAY is available anywhere that database fields can be referenced directly, including service and salary transformation expressions, data defaults, eligibility selection expressions and database field type benefit formula components.
Syntax:
a # INARRAY b
where:
a is a number, code, date, field, or values created by temporary assignment. If an array field is referenced directly, only the most recent (scalar) value is used,
b is an array field, or values created by temporary assignment
If a is a value (not an effective, start or stop date) in array b, then 1 is returned; otherwise, 0 is returned. If a was created by temporary assignment and has multiple values, then if any value in a is in array b, a scalar 1 is returned; if none of the values in a are in b, then a scalar 0 is returned.
Examples
LOC is an effective date array indicating in which locations the participant has been.
LOC contains
Date Code (desc) 1/01/1980 1 BCB 1/01/1990 2 MWC 1/01/1999 1 BCB 1/01/2012 2 MWC
The following are examples of some of the ways to use #INARRAY:
Example
Code Comments Result 1. 1 #INARRAY LOC ; were you ever in location 1? 1 2. 2 #INARRAY LOC ; were you ever in location 2? 1 3. 3 #INARRAY LOC ; were you ever in location 3? 0 4. (1 #INARRAY LOC) #AND (2 #INARRAY LOC) ; have you worked in both locations 1 and 2? 1 5. (1 #INARRAY LOC) #OR (3 #INARRAY LOC) ; did you ever work in location 1 or location 3? 1