IBX.IBCustomDataSet.TIBCustomDataSet.Lookup
Delphi
function Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant; override;
C++
virtual System::Variant __fastcall Lookup(const System::UnicodeString KeyFields, const System::Variant &KeyValues, const System::UnicodeString ResultFields);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | IBX.IBCustomDataSet.pas IBX.IBCustomDataSet.hpp |
IBX.IBCustomDataSet | TIBCustomDataSet |
Description
Retrieves field values from a record that matches specified search values.
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 System.Variants.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
. If no record is matched, the method calls Null to return a null variant.
If the search fields in KeyFields
are indexed, Lookup uses the index. Otherwise, Lookup creates a filter for the search.
For a IBDataSet1
dataset and a connection to an employee.gdb database from the Interbase Installation folder, the Delphi code should look like this:
var keyfield, keyvalue, resultVariant: Variant;
resultFields:string;
begin
keyfield:='COUNTRY';
keyvalue:='USA';
resultFields:='CURRENCY';
resultvar:=Form1.IBDataSet1.Lookup(keyfield,keyvalue,resultFields);
end;