Click or drag to resize

Seek Function

X#
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.24 GA
Syntax
 FUNCTION Seek(
	uExpression,
	uWorkarea,
	uOrder
) AS LOGIC CLIPPER
Request Example View Source

Parameters

uExpression (Optional)
Type: Usual
uWorkarea (Optional)
Type: Usual
uOrder (Optional)
Type: Usual

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.
Remarks
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.
Examples
X#
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