Navigation: Language Reference > 13 - Built-in Functions >====== INLIST (return entry in list) ====== | |
INLIST(searchstring,liststring,liststring [,liststring…])
INLIST | Returns item in a list. |
searchstring | A constant, variable, or expression that contains the value for which to search. If the value is numeric, it is converted to a string before comparisons are made. |
liststring | The label of a variable or constant value to compare against the searchstring. If the value is numeric, it is converted to a string before comparisons are made. There may be up to 25 liststring parameters, and there must be at least two. |
The INLIST procedure compares the contents of the searchstring against the values contained in each liststring parameter. If a matching value is found, the procedure returns the number of the first liststring parameter containing the matching value (relative to the first liststring parameter). If the searchstring is not found in any liststring parameter, INLIST returns zero.
Return Data Type: | LONG |
Example:
INLIST('D','A','B','C','D','E') !returns 4
INLIST('B','A','B','C','D','E') !returns 2
EXECUTE INLIST(Emp:Status,'Fulltime','Parttime','Retired','Consultant')
Scr:Message = 'All Benefits' !Full timer
Scr:Message = 'Holidays Only' !Part timer
Scr:Message = 'Medical/Dental Only' !Retired
Scr:Message = 'No Benefits' !Consultant
END
See Also: