Format:
i = seek(multiple-item condition[,numeric-expr]);
Description:
The seek function returns the occurrence
number of the first item in a multiply occurring item that satisfies a
certain condition. If numeric-expr
is included, the function starts searching the multiply occurring record
for a true condition starting at occurrence numeric-expr.
If a @ symbol precedes the numeric-expr,
the function searches for the nth
occurrence of the condition.
Return value:
The function returns the occurrence number of an item that meets the condition
or 0 if no such item is found.
Example 1:
numeric
femaleIndex = seek(SEX = 2);
while femaleIndex do
write("Person
#%d is a female with name '%s'",femaleIndex,NAME(femaleIndex));
femaleIndex = seek(SEX
= 2,femaleIndex + 1);
enddo;
Example 2:
numeric secondSpouse = seek(RELATIONSHIP = 2,@2);
See also: Count Function, Has Operator, Seekmax Function, Seekmin Function