Click or drag to resize

Seek Function

-- todo --
Searches an indexed table for the first occurrence of a record whose index key matches a specified expression. Issuing Seek( ) is equivalent to issuing Seek and FOUND( ) in succession.
X# does not support seek operations for binary indexes.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Request Example View Source


eExpression (Optional)
Type: Usual
Specifies the index key expression for which you want Seek( ) to search.
uArea (Optional)
Type: Usual
Specifies the work area number of the table that is searched for the index key.
Specifies the alias of the table that is searched. If you omit uArea, the table in the currently selected work area is searched.
uIndex (Optional)
Type: Usual
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 Command.

Return Value

Type: Logic
Logical. Seek( ) returns True (.T.) if a match is found and the record pointer moves to the matching record. Otherwise, Seek( ) returns False (.F.) if a match is not found, and the record pointer moves to the end of the file if Set NEAR is OFF or to the closest matching record if Set NEAR is ON.
You can use Seek( ) on a table with an index order set, or if an index order is not set on the table, set the controlling index with the 3rd parameter, nIndexNumber, cIDXIndexFileName, or cTagName. The match must be exact unless Set EXACT is set to OFF.
If you omit the nIndexNumber, IDXIndexFileName, and cTagName arguments, Seek( ) uses the master controlling index or index tag to search for the index key.
The Set KEY setting is ignored if Seek( ) uses a non-active index.
1Close Databases
2Open Database (HOME(2) + 'Data\testdata')
3Use customer Order cust_id  // Opens Customer table
4? Seek('CHOPS')  // Returns .T., record found
See Also