IDtMetabaseConsumer.KeyFieldNames

Syntax

KeyFieldNames: String;

Description

The KeyFieldNames property determines key fields list, by which values updated records are searched.

Comments

Fields in the list are determined by the ; character.

Example

Executing the example requires that the repository contains a table with the TABLE_1 identifier and an Excel file named Data.xls in the root directory of the C disk. Data type and a number of columns with data in Excel file correspond to table fields list.

Sub UserProc;
Var
    MB: IMetabase;
    ExcelProvider: IDtExcelProvider;
    MBConsumer: IDtMetabaseConsumer;
    Table: IDatasetModel;
    Fields: IDatasetModelFields;
Begin
    MB := MetabaseClass.Active;
    // New data provider
    ExcelProvider := New DtExcelProvider.Create;
    ExcelProvider.DriverVersion := "Excel 8.0";
    ExcelProvider.File := "c:\Data.xls";
    ExcelProvider.HasHeader := True;
    ExcelProvider.Query := "Select * from [Sheet1$]";
    // New data consumer
    Table := MB.ItemById("Table_1").Bind As IDatasetModel;
    MBConsumer := New DtMetabaseConsumer.Create;
    MBConsumer.Dataset := Table;
    Fields := Table.Fields;
    MBConsumer.Open;
    MBConsumer.KeyFieldNames := Fields.Item(0).Id;
    MBConsumer.PutProvider(ExcelProvider);
    MBConsumer.Close
End Sub UserProc;

After executing the example a new data provider and data consumer are created. The data provider will be set up for import from Microsoft Excel file, the data consumer is set up for data export top repository table. During data export entries are updated by the content of the first table field.

See also:

IDtMetabaseConsumer