Retrieves field values from a record that matches specified search values.
Syntax:
function Lookup(const KeyFields: String;
const KeyValues: Variant;
const ResultFields: String): Variant;Description:
Call Lookup to retrieve values for specified fields from a record that matches search criteria.
KeyFields is a string containing a semicolon-delimited list of field names on which to search.
KeyValues is a variant array containing the values to match in the key fields. To specify
multiple search values, pass KeyValues as a variant array as an argument, or construct a variant
array on the fly using the VarArrayOf routine.
ResultFields is a string containing a semicolon-delimited list of field names whose values should
be returned from the matching record.
Lookup returns a variant array containing the values from the fields specified in
ResultFields.
Lookup uses the fastest possible method to locate matching records. If the search fields in
KeyFields are indexed, Lookup uses the index. Otherwise Lookup creates a filter
for the search.
 | Delphi 7 and prior has poor support for int64 values in variant type.
This means that you'll be unable to use Locate()
and similar methods with such fields. Lookup fields will not work proper too due to their
dependence on Locate() method. Please update your
IDE to BDS 2006 or don't use bigint (int8) and bigserial datatypes for keys
and indexes if you need to use them in lookup fields. |