LISTINDEX() |
![]() ![]() ![]() |
The LISTINDEX() function returns the position of an item in a delimited list.
Format
LISTINDEX(list, delimiter, item)
where
The LISTINDEX() function returns the position of item in the delimited list. If it is not found, the function returns zero.
See the LOCATE statement for a more powerful way of dynamic arrays.
Examples
SUFFIX = FIELD(DOC.NAME, ".", DCOUNT(DOC.NAME, ".")) IF LISTINDEX("TXT,DOC,PDF", ",", SUFFIX) THEN DISPLAY DOC.NAME END
This program fragment extracts the suffix from a Windows style file name and checks whether it is TXT, DOC or PDF. If so, the document name is displayed.
LISTINDEX(PROD.NO, @VM, PART); IF @ THEN QTY<1,@> ELSE ""
Used as an expression in a dictionary I-type item, this example searches field PROD.NO for an entry containing PART and extracts the corresponding entry from the QTY field. If the item is not found, a null string is returned.
See also: DEL, DELETE(), EXTRACT(), FIND, FINDSTR, INS, INSERT(), LOCATE, LOCATE(), REPLACE() |