TMemDataset.Lookup function
Searches for a record with the specified values, and returns a list of values.
Declaration
function Lookup(const KeyFields: string; const KeyValues: Variant;
const ResultFields: string): Variant; overrideArguments
KeyFields | Field names to lookup in the method. |
KeyValues | Field values to lookup in the method. |
ResultFields | Field names to include in the return values. |
Function result
Variant array of return values for the result field names.
Description
Lookup is an overridden Variant function used to search for the first record that matches the specified values. KeyFields is a comma-delimited list of field names to examine in the method. KeyValues is a variant array with values for the specified field names. ResultFields is a comma-delimited list of field names to include in the return values for the method.
Lookup calls MDSLocateRecord to search for the specified values in the record data for the in-memory dataset. If a record is located that matches the search criteria, calculated or lookup fields in the dataset are recalculated. The return value is a variant array with values for the fields specified in ResultFields. The return value is set to Null if a record with the specified search values is not found.
Please note that Lookup does not change the active record in the dataset.
For example:
var AResultVals: Variant;
AResultVals := AMemDS.Lookup('lastname, firstname', VarArrayCreate('Franks', 'Peter'), 'lastname, firstname, birthdate');
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
