Determines whether an expression matches another expression in a set of expressions.
INLIST(eExpression1, eExpression2 [, eExpression3 ...])
- Specifies the expression INLIST(В ) searches for in the set of expressions.
- eExpression2[, eExpression3...]
- Specifies the set of expressions to search. You must include at least one expression (eExpression2), and can include up to 25 expressions (eExpression2, eExpression3, and so on). All the expressions in the set of expressions must be of the same data type.
Logical or null value
INLIST(В ) returns true (.T.) if it finds the expression in the set of expressions; otherwise INLIST(В ) returns false (.F.). The null value is returned if eExpression1 is the null value. The null value is also returned if eExpression1 is not the null value, eExpression1 does not match another expression, and at least one of the other expressions is the null value.
In this example, INLIST(В ) determines the quarter of the year for the current month. The current month is stored to the variable
gcMonth. Each CASE statement uses INLIST(В ) to determine whether the contents of
gcMonth can be found in a list of month names. The name of the quarter returned is stored to the variable
SET TALK ON STORE CMONTH(DATE( )) TO gcMonth DO CASE CASE INLIST(gcMonth,'January','February','March') STORE 'First Quarter' TO gcReporTitle CASE INLIST(gcMonth,'April','May','June') STORE 'Second Quarter' TO gcReporTitle CASE INLIST(gcMonth,'July','August','September') STORE 'Third Quarter' TO gcReporTitle OTHERWISE STORE 'Fourth Quarter' TO gcReporTitle ENDCASE WAIT WINDOW gcReporTitle