INLIST Function
Syntax
Arguments
- lookfor
A constant, variable, or an expression that creates any type of value.
- value_1
An expression or field that returns a value as the same type as Search_Value. Any type
- value
Optional. Up to 24 additional expressions or fields that return a value as the same type as Search_Value. Any type
Description
Returns TRUE if first expr matches any remaining exp's in the parameter list.
Discussion
INLIST() searches for a matching value in a list of one or more expressions or fields from the same record. The function returns .T. (TRUE) if the Search_Value matches any of the remaining expressions; returns .F. (FALSE) if the value is not found in a specified expression. INLIST() accepts up to 25 expressions. All expressions used with INLIST() must be of the same type.
Assume that the table HOURS contains the following records:
- Hours
- Week Ending
M T W TH F S
- 9/9/2015
8.00 8.75 9.00 10.50 8.00 4.00
- 9/16/2015
8.00 8.00 8.50 9.50 8.00 0.00
The following expression checks for a numeric value within several numeric expressions:
inlist(9, FLOOR(M), FLOOR(T), FLOOR(W), FLOOR(TH), FLOOR(F)) inlist("red", "blue", "red", "green") -> .T. inlist("red ", "blue", "red", "green") -> .F. inlist("Red", "blue", "red", "green") -> .F. inlist(ut("Red"), "BLUE", "RED", "GREEN") -> .T.
The example checks if 9, or 9 and any fraction, is stored in any of the listed fields. FLOOR is used to return an integer (9 from 9.5, for example). INLIST() returns TRUE for both records.
Limitations
INLIST() search is case sensitive and length sensitive.
See Also