![]() ![]() |
|
LOCATEThe LOCATE statement finds the position of an element within a specified dimension of a dynamic array.
COMMAND SYNTAXLOCATE expression1 IN expression2{<expression3{,expression4}>}, {,expression5} {BY expression6} SETTING Var THEN|ELSE statement(s) LOCATE(expression1, expression2{,expression3{,expression4}}; Var; expression6) THEN|ELSE statements
SYNTAX ELEMENTSexpression1 evaluates to the string that will be searched for in expression2.
Var will be set to the position of the Field, Value or Sub-Value in which expression1 was found if indeed, it was found. If it was not found and expression6 was not specified then Var will be set to one position past the end of the searched dimension. If expression6 did specify the order of the elements then Var will be set to the position before which the element should be inserted to retain the specified order. The statement must include one of or both of the THEN and ELSE clauses. If expression1 is found in an element of the dynamic array the statements defined by the THEN clause are executed. If expression1 is not found in an element of the dynamic array the statements defined by the ELSE clause are executed.
NOTES
EXAMPLES
|