[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
SEEK command
Search an Order for a specified key value
------------------------------------------------------------------------------
Syntax
SEEK <expSearch> [SOFTSEEK]
Arguments
<expSearch> is an expression to match with an Order key value.
SOFTSEEK causes the record pointer to be moved to the next record
with a higher key value after a failed Order search. Default behavior
moves the record pointer to EOF() after a failed Order search.
Description
SEEK is a database command that searches the controlling Order from the
first key value and proceeding until a match is found or there is a key
value greater than <expSearch>. If there is a match, the record pointer
is positioned to the identity found in the Order. If SOFTSEEK is OFF
(the default) and SEEK does not find a match, the record pointer is
positioned to LASTREC() + 1, EOF() returns true (.T.), and FOUND()
returns false (.F.).
SOFTSEEK enables a method of searching an Order and returning a record
even if there is no match for a specified key.
When SOFTSEEK is ON and a match for a SEEK is not found, the record
pointer is set to the next record in the Order with a higher key value
than the SEEK argument. Records not visible because SET FILTER and/or
SET DELETED are skipped when searching for the next higher key value.
If there is no record with a higher key value, the record pointer is
positioned at LASTREC() + 1, EOF() returns true (.T.), and FOUND()
returns false (.F.). FOUND() returns true (.T.) only if the record is
actually found. FOUND() never returns true (.T.) for a relative find.
When SOFTSEEK is OFF and a SEEK is unsuccessful, the record pointer is
positioned at LASTREC() + 1, EOF() returns true (.T.), and FOUND()
returns false (.F.).
SEEK with the SOFTSEEK clause is, effectively, the same as performing
SET SOFTSEEK then SEEK in earlier versions of CA-Clipper except that is
does not change the global setting of SOFTSEEK.
Examples
. The following example searches for "Doe" using the SEEK
command:
USE Customer NEW
SET ORDER TO Customer
? SET( _SET_SOFTSEEK ) // (.F.)
SEEK "Doe"
? SET( _SET_SOFTSEEK ) // Still (.F.)
IF FOUND()
.
. < statements >
.
ENDIF
. The following example performs a soft seek for "Doe" using
SOFTSEEK clause of the SEEK command:
USE Customer NEW
SET ORDER TO Customer
SEEK "Doe" SOFTSEEK
IF !FOUND()
? Customer->Name // Returns next logical name after "Doe"
ENDIF
Status: Enhanced
See also: DBSEEK()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson