IMetaRdsLoader.Load

Fore Syntax

Load(UpdateMode: UpdateLoadMode);

Fore.NET Syntax

Load(UpdateMode: Prognoz.Platform.Interop.Metabase.UpdateLoadMode);

Parameters

UpdateMode. Mode of updating dictionary records.

Description

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

Fore Example

Executing the example requires that repository contains the MDM dictionary 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 object to create table MDM dictionary and to 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 used to create table MDM dictionaries and load data to these dictionaries. 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.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
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 := Params.Metabase;
    // 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 object to create table MDM dictionary and to 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.ulmInsert);
End Sub;

See also:

IMetaRdsLoader