[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
SEEK
Search an index for a specified key value
------------------------------------------------------------------------------
Syntax
SEEK <expSearch>
Arguments
<expSearch> is an expression to match with an index key.
Description
SEEK is a database command that searches the controlling index starting
with the first key and proceeds 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 record number found in the index. 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.). If SOFTSEEK is ON, the record pointer is
positioned to the record with the first key value greater than the
search argument and FOUND() returns false (.F.). In this case, EOF()
only returns true (.T.) if there are no keys in the index greater than
the search argument.
SET EXACT has no effect on the operation of SEEK.
Examples
. This example illustrates the SEEK command:
USE Sales INDEX Branch NEW
SEEK "100"
? FOUND(), EOF(), RECNO() // Result: .T. .F. 1
. This user-defined function performs an exact SEEK for an index
with a character key:
USE Invoice INDEX Invoice NEW
IF SeekExact("10001")
? "Invoice on file"
ELSE
? "Invoice not on file"
ENDIF
RETURN
FUNCTION SeekExact( cSearch )
SEEK PADR(cSearch, LEN(&(INDEXKEY(0))))
RETURN (FOUND())
Files: Library is CLIPPER.LIB.
See Also:
EOF()
FOUND()
SET SOFTSEEK
DBSEEK()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson