INDEXSEEK( ) Function
Without moving the record pointer, searches an indexed table for the first occurrence of a record whose index key matches a specified expression.
INDEXSEEK(eExpression [, lMovePointer [, nWorkArea | cTableAlias
[, nIndexNumber | cIDXIndexFileName | cTagName]]])
Return Values
Logical
Parameters
eExpression
Specifies the index key expression for which you want INDEXSEEK( ) to search.lMovePointer
Specifies if the record pointer is moved to the matching record. If lMovePointer is true (.T.) and a matching record exists, the record pointer is moved to the matching record. If lMovePointer is true (.T.) and a matching record doesn't exist, the record pointer isn't moved. If lMovePointer is false (.F.) or is omitted, the record pointer isn't moved even if a matching record exists.nWorkArea
Specifies the work area number of the table that is searched for the index key.cTableAlias
Specifies the alias of the table that is searched. If you omit nWorkArea and cTableAlias, the table in the currently selected work area is searched.nIndexNumber
Specifies the number of the index file or tag that is used to search for the index key. nIndexNumber refers to the index files as they are listed in USE or SET INDEX. Open .IDX files are numbered first in the order in which they appear in USE or SET INDEX. Tags in the structural .cdx file (if one exists) are then numbered in the order in which they were created. Finally, tags in any open independent .cdx files are numbered in the order in which they were created. For more information about index numbering, see SET ORDER.cIDXIndexFileName
Specifies an .idx file that is used to search for the index key.cTagName
Specifies a tag of a .cdx file that is used to search for the index key. The tag name can be from a structural .cdx file or any open independent .cdx file.Note The .idx file takes precedence if duplicate .idx file and tag names exist.
Remarks
INDEXSEEK( ) returns true (.T.) if a match is found; otherwise false (.F.) is returned. You can use INDEXSEEK( ) only with a table with an index order set, and you can search only for an index key. The match must be exact unless SET EXACT is set to OFF.
INDEXSEEK( ) provides a fast way to search for records without moving the record pointer. Because the record pointer isn't moved, rules and triggers aren't executed. If INDEXSEEK( ) returns true (.T.) indicating that a matching record is found, you can execute INDEXSEEK( ) again with the second parameter lMovePointer set to true (.T.) to move to the matching record.
INDEXSEEK( ) returns false (.F.) when you are attempting to find a value in the most recently created record (created with INSERT INTO or APPEND BLANK) until the record pointer is moved. You can execute a GO BOTTOM command to cause INDEXSEEK( ) to find the most recently created record.
See Also
INDEX | KEYMATCH( ) | LOCATE | SEEK | SEEK( )