Click or drag to resize

Lookup Function

X#
-- todo --
Searches a table for the first record with a field matching the specified expression.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION Lookup(
	ReturnField,
	eSearchExpression,
	SearchedField,
	cTagName
) AS USUAL CLIPPER
Request Example View Source

Parameters

ReturnField (Optional)
Type: Usual
eSearchExpression (Optional)
Type: Usual
SearchedField (Optional)
Type: Usual
cTagName (Optional)
Type: Usual

Return Value

Type: Usual
Character, Numeric, Currency, Float, Integer, Double, Date, DateTime, or Logical.
Remarks
If the search is successful, LOOKUP( ) moves the record pointer to the matching record and returns the contents of a specified field in the record.
If LOOKUP( ) does not find the search expression, it returns a blank value the same length and data type as ReturnField. The record pointer is positioned at the end of the file.
If you use LOOKUP( ) to search a parent table, record pointers in all related child tables are moved to the related records.
This function cannot be optimized with Rushmore Query Optimization.
Examples
X#
1Close Databases
2Open Database (HOME(2) + 'data\testdata')
3Use customer Order company  // Open Customer table
4Clear
5@ 2,2 SAY LOOKUP(contact, 'Ernst Handel', company, 'company')
See Also