IMetaRdsLoader.Load

Syntax

Load(UpdateMode: UpdateLoadMode);

Parameters

UpdateMode. Mode of updating dictionary records.

Description

The Load method loads data from a source to MDM dictionary.

Example

Executing the example requires that the repository contains a folder with the MDM identifier and the C:\data.xls Microsoft Excel file corresponding to the following requirements:

  1. The file should contain column titles.

  2. The file should contain the Name column which contains and which does not include missing data.

  3. The file should contain the Key column including integer data.

Add links to the system assemblies: Dt, Metabase, Rds.

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    RdsLoader: IMetaRdsLoader;
    ExcelProvider: IDtExcelProvider;
Begin
    // Create data source for dictionary and set its parameters
    ExcelProvider := New DtExcelProvider.Create;
    ExcelProvider.DriverVersion := "Excel 8.0";
    ExcelProvider.File := "C:\Data.xls";
    ExcelProvider.HasHeader := True;
    ExcelProvider.Query := "Select * From  [Sheet1$]";
    // Get current repository
    MB := MetabaseClass.Active;
    // Determine information about created dictionary
    CrInfo := MB.CreateCreateInfo;
    CrInfo.Parent := MB.ItemById("MDM");
    CrInfo.Permanent := True;
    CrInfo.Id := MB.GenerateId("NewDictionary", CrInfo.Parent.Key);
    // Create an object to create an MDM dictionary and load data to it
    RdsLoader := New MetaRdsLoader.Create;
    // Determine data source of created dictionary
    RdsLoader.Source := ExcelProvider;
    // Generate bindings of data source fields and of created dictionary
    RdsLoader.GenerateBindingsBySource;
    // Create a dictionary
    (RdsLoader.CreateObject(CrInfo) As IMetabaseObject).Save;
    // Load data
    RdsLoader.Load(UpdateLoadMode.Insert);
End Sub UserProc;

Executing the example initializes the object that is used to create MDM dictionaries and to load data to them. Data source is specified to create a dictionary, and bindings to source fields are generated automatically. After that a dictionary is created, and data is loaded to the dictionary.

See also:

IMetaRdsLoader