[About The Guide]
Search sequentially for a record matching a condition
LOCATE [<scope>] FOR <lCondition>
<scope> is the portion of the current database file in which to
perform the LOCATE. The default scope is ALL records.
FOR <lCondition> specifies the next record to LOCATE within the
WHILE <lCondition> specifies the set of records meeting the
condition from the current record until the condition fails.
LOCATE is a database command that searches for the first record in the
current work area that matches the specified conditions and scope. When
you first execute a LOCATE, it searches from the beginning record of the
scope for the first matching record in the current work area. It
terminates when a match is found or the end of the LOCATE scope is
reached. If it is successful, the matching record becomes the current
record and FOUND() returns true (.T.). If it is unsuccessful, FOUND()
returns false (.F.) and the positioning of the record pointer depends on
the controlling scope of the LOCATE.
Each work area can have its own LOCATE condition. The condition remains
active until you execute another LOCATE command in that work area or the
LOCATE works with CONTINUE. Once a LOCATE has been issued, you can
resume the search from the current record pointer position with
CONTINUE. There are, however, some exceptions. See note below.
. CONTINUE: Both the <scope> and the WHILE condition apply only
to the initial LOCATE and are not operational for any subsequent
CONTINUE commands. To continue a pending LOCATE with a scope or
WHILE condition, use SKIP then LOCATE REST WHILE <lCondition> instead
. These examples show typical LOCATEs:
USE Sales INDEX Salesman
LOCATE FOR Branch = "200"
? FOUND(), EOF(), RECNO() // Result: .T. .F. 5
LOCATE FOR Branch = "5000"
? FOUND(), EOF(), RECNO() // Result: .F. .T. 85
. This example shows a LOCATE with a WHILE condition that is
continued by using LOCATE REST:
LOCATE FOR Branch = "200" WHILE Salesman = "Bill"
DO WHILE FOUND()
? Branch, Salesman
LOCATE REST FOR Branch = "200" WHILE ;
Salesman = "Bill"
Files Library is CLIPPER.LIB.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson