IRdsImportSchemas.Add

Fore Syntax

Add: IRdsImportSchema;

Fore.NET Syntax

Add: Prognoz.Platform.Interop.Rds.IRdsImportSchema;

Description

The Add method creates a new scheme of import.

Fore Example

Executing the example requires the MDM repository NSI_1 that contains an MDM dictionary with the Dict_1 identifier.The database defined for the MDM repository, contains the TabImport table that includes fields with the names as basic dictionary attributes.

Add a link to the Rds system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict: IRdsDictionary;
    Import: IRdsImportSchemas;
    SchemaImport: IRdsImportSchema;
    Attrs: IRdsAttributes;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace(
"NSI_SEP", MB.ItemById("NSI1").Key).Edit;
    Dict := MObj 
As IRdsDictionary;
    Attrs := Dict.Attributes;
    Import := Dict.ImportSchemas;
    SchemaImport := Import.Add;
    SchemaImport.Id := 
"Import1";
    SchemaImport.Name := 
"Import scheme №1";
    SchemaImport.Mappings(Attrs.Key).FieldName := 
"ID";
    SchemaImport.Mappings(Attrs.Name).FieldName := 
"NAME";
    SchemaImport.Mappings(Attrs.Order).FieldName := 
"ORD";
    SchemaImport.Mappings(Attrs.ParentKey).FieldName := 
"PARENT_KEY";
    SchemaImport.TableName := 
"SEP";
    MObj.Save;
End Sub UserProc;

After executing the example a new import scheme is created in the MDM dictionary. Attribute values of a dictionary are imported from same-name fields of the TabImport table.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict: IRdsDictionary;
    Import: IRdsImportSchemas;
    SchemaImport: IRdsImportSchema;
    Attrs: IRdsAttributes;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemByIdNamespace["NSI_SEP", MB.ItemById["NSI1"].Key].Edit();
    Dict := MObj As IRdsDictionary;
    Attrs := Dict.Attributes;
    Import := Dict.ImportSchemas;
    SchemaImport := Import.Add();
    SchemaImport.Id := "Import1";
    SchemaImport.Name := Import scheme #1;
    SchemaImport.Mappings[Attrs.Key].FieldName := "ID";
    SchemaImport.Mappings[Attrs.Name].FieldName := "NAME";
    SchemaImport.Mappings[Attrs.Order].FieldName := "ORD";
    SchemaImport.Mappings[Attrs.ParentKey].FieldName := "PARENT_KEY";
    SchemaImport.TableName := "SEP";
    MObj.Save();
End Sub;

See also:

IRdsImportSchemas