IRdsExportSchema.Mappings

Syntax

Mappings(Attribute: IRdsAttribute): IRdsExportSchemaAttribute;

Parameters

Attribute. Attribute of the MDM dictionary, for which it is necessary to specify binding to fields of export table.

Description

The Mappings property returns parameters of binding of the MDM dictionary attributes to fields of a table, into which data is exported.

Example

Executing the example requires the MDM repository NSI_1 that contains an MDM dictionary with the Dict_1 identifier.The dictionary contains the ATTRIBUTE attribute connected with another dictionary. This attribute may also have multiple values. The database, that is set for the MDM repository, contains two tables: TabExport - a table that contains fields with names as names of basic attributes of a dictionary. A basic tree structure of dictionary elements is exported in this table; TabValue - a table that contains records that determine multiple values of the ATTRIBUTE attribute.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

Dict: IRdsDictionary;

Export: IRdsExportSchemas;

SchemaExport: IRdsExportSchema;

SchemaExportAttr: IRdsExportSchemaAttribute;

Attrs: IRdsAttributes;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Edit;

Dict := MObj As IRdsDictionary;

Attrs := Dict.Attributes;

Export := Dict.ExportSchemas;

SchemaExport := Export.Add;

SchemaExport.Id := "Export1";

SchemaExport.Name := Export scheme #1;

//Binding basic attributes

SchemaExport.Mappings(Attrs.Key).FieldName := "Key";

SchemaExport.Mappings(Attrs.Name).FieldName := "Name";

SchemaExport.Mappings(Attrs.Order).FieldName := "Ord";

SchemaExport.Mappings(Attrs.ParentKey).FieldName := "Parent";

SchemaExport.TableName := "TabExport";

SchemaExportAttr := SchemaExport.Mappings(Attrs.FindById("ATTRIBUTE"));

//Binding an attribute that has multiple values

SchemaExportAttr.FieldName := "Key1";

SchemaExportAttr.DetailTable := "TabValue";

SchemaExportAttr.KeyField := "Key";

SchemaExportAttr.ValueField := "Value";

SchemaExportAttr.OrderField := "Value_Number";

MObj.Save;

End Sub Main;

After executing the example a new export scheme is created in the MDM dictionary. Attribute values of a dictionary are exported in same-name fields of the TabExport table. Multiple values of the ATTRIBUTE attribute are exported in the TabValue table.

See also:

IRdsExportSchema