LOCATE

LOCATE

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

LOCATE

Locates a particular member of a result set and makes it the current member.

Syntax

LOCATE [num] [set] [WHERE clause]

Parameters

numThe number of records to be located. Num can be
an integer constant (e.g., 15, 200);
a variable, form field, menu item, or formal parameter that evaluates to an integer;
the word ALL.
The default value for num is 1.
setThe name of a result set. If not specified, the current set (if it exists) is used.

Comments

LOCATE starts searching at the current member of the set. The last member located becomes the current member of set. The system variable $Located is set to the number of members located, indicating the number of members in the result set.

The WHERE clause can be used to logically limit the members located.

Example

find all employees where location=”Detroit” -> DetroitSet

locate DetroitSet where FirstName=”John” and LastName=”Smith”

locate 2 DetroitSet where FirstName=”John” and LastName=”Smith”

Because LOCATE starts with the current member of any set it searches, the current member after the last LOCATE command is the third record containing the name John Smith.

find all Employees where LastName=”Smith” -> Smiths

locate all where FirstName=”John”

output $located

compute all Employees where LastName=”Smith” and FirstName=”John” valuate (“”)

output $membercount

find all Employees where LastName=”Smith” and FirstName=”John”

output $setcount

All three of the preceding examples determine how many employees have the name John Smith.

while

locate DetroitSet where LastName=”Smith” and FirstName=”John”

if $located = 0

  return    % checks if done

endif

ProcessEmp ( )  % program to process this John Smith

endwhile

Each John Smith record in the designated set is processed.

See Also

BOTTOM

DOWN

NEXT

PREVIOUS

TOP

UP

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish