IRdsImportSchemaAttribute.DetailTable

Syntax

DetailTable: String;

Description

The DetailTable property determines name of a table containing records for multiple values of a dictionary attribute.

Comments

The property is mandatory. It is also required to set the IRdsImportSchemaAttribute.DetailTableObject property for correct import.

Example

Executing the example requires that the repository contains a table with the TABLE_EXP, TABLE_EXP_VALUE identifiers, an MDM repository with the MDM_REPO identifier containing an MDM dictionary with the MDM_DICTIONARY identifier. These objects should use the same database and satisfy the following requirements:

Add links to the Db, Metabase, Rds system assemblies.

Sub UserImport;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict: IRdsDictionary;
    Import: IRdsImportSchemas;
    SchemaImport: IRdsImportSchema;
    Attrs: IRdsAttributes;
    TableObj: IMetabaseObjectDescriptor;
    Table: ITable;
    SchemaImportAttr: IRdsImportSchemaAttribute;
    DictInst: IRdsDictionaryInstance;
Begin
    MB := MetabaseClass.Active;
    // Get MDM dictionary
    MObj := MB.ItemByIdNamespace("MDM_DICTIONARY_IMPORT", MB.ItemById("MDM_REPO").Key).Edit;
    Dict := MObj As IRdsDictionary;
    // Get MDM dictionary attributes
    Attrs := Dict.Attributes;
    // Create a new import scheme
    Import := Dict.ImportSchemas;
    SchemaImport := Import.Add;
    SchemaImport.Id := "IMPORT_SCHEME";
    SchemaImport.Name := Import scheme #1;
    // Set binding of MDM dictionary system attributes
    SchemaImport.Mappings(Attrs.Key).FieldName := "KEY";
    SchemaImport.Mappings(Attrs.Name).FieldName := "NAME";
    SchemaImport.Mappings(Attrs.Order).FieldName := "ORD";
    SchemaImport.Mappings(Attrs.ParentKey).FieldName := "PARENT_KEY";
    // Get the TABLE_EXP table
    TableObj := MB.ItemById("TABLE_EXP");
    Table := TableObj.Bind As ITable;
    // Specify that import of system attribute values
    // will be performed from the TABLE_EXP table
    SchemaImport.TableObject := TableObj;
    SchemaImport.TableName := Table.NativeName;
    // Set binding of the attribute, which may take multiple values
    SchemaImportAttr := SchemaImport.Mappings(Attrs.FindById("ATTRIBUTE"));
    //Get the TABLE_EXP_VALUE table
    TableObj := MB.ItemById("TABLE_EXP_VALUE");
    // Specify, that import of multiple attribute values
    // will be performed from the TABLE_EXP_VALUE table
    Table := TableObj.Bind As ITable;
    SchemaImportAttr.DetailTable := Table.NativeName;
    SchemaImportAttr.DetailTableObject := TableObj;
    // Set options of import of attribute multiple values
    SchemaImportAttr.Attribute.Hidden := False;
    SchemaImportAttr.FieldName := "KEY_EXP";
    SchemaImportAttr.KeyField := "KEYFIELD";
    SchemaImportAttr.ValueField := "VALUEFIELD";
    SchemaImportAttr.OrderField := "ORDERFIELD";
    // Save import scheme
    MObj.Save;
    // Run import
    DictInst := Dict.Open(Null);
    DictInst.ImportData(SchemaImport);
End Sub UserImport;

After executing the example a new import scheme is created in the MDM dictionary. Attribute values of the MDM_DICTIONARY dictionary are imported from same-name fields of the TABLE_EXP table. Multiple values of the ATTRIBUTE attribute are imported from the TABLE_EXP_VALUE table. Import will be executed.

See also:

IRdsImportSchemaAttribute