ICubeMetaUpdateDictionaryRemapings.Add

Syntax

Add: ICubeMetaUpdateDictionaryRemaping;

Description

The Add method adds a new correspondence to the collection.

Example

Executing the example requires that the repository contains a time series database with the FC identifier that contains custom attributes of the COUNTRY and INDICATOR indicators. Attributes must be unique and refer to the dictionaries. It also must contain an MDM repository with the MDM_REPO_COPY1 identifier that is a clone of MDM repository for the time series database.

Sub UserProc;
Var
    Mb: IMetabase;
    RubUpdateEx: ICubeMetaUpdateEx;
    Rub: IRubricator;
    Progress: IMetabaseUpdateProgress;
    CrInfo: IMetabaseObjectCreateInfo;
    DictRemapings: ICubeMetaUpdateDictionaryRemapings;
    DictRemap: ICubeMetaUpdateDictionaryRemaping;
    Attr: IMetaAttributes;
    RepoCopy, SourceDict: IMetabaseObjectDescriptor;
    s: string;
Begin
    Mb := MetabaseClass.Active;
    RubUpdateEx := New CubeMetaUpdateClass.Create As ICubeMetaUpdateEx;
    Rub := Mb.ItemById("FC").Bind As IRubricator;
    RubUpdateEx.Rubricator := Rub;
    RubUpdateEx.Metabase := Mb;
    CrInfo := RubUpdateEx.CreateInfo;
    CrInfo.Parent := Mb.Root;
    s := Mb.GenerateId("FC_COPY");
    CrInfo.Id := s;
    CrInfo.Name := s;
    RepoCopy := Mb.ItemById("RDS_REPO_COPY1");
    RubUpdateEx.RdsDatabase := RepoCopy.Bind As IRdsDatabase;
    DictRemapings := RubUpdateEx.DictionaryRemapings;
    DictRemapings.Clear;
    // Set correspondence for the COUNTRY attribute
    DictRemap := DictRemapings.Add;
    Attr := Rub.Facts.Attributes;
    SourceDict := Attr.FindById("COUNTRY").ValuesObject;
    DictRemap.SourceId := SourceDict.Id;
    DictRemap.SourceKey := SourceDict.Key;
    DictRemap.Target := mb.ItemByIdNamespace("DICT_CTR_COPY1", RepoCopy.Key);
    // Set correspondence for the INDICATOR attribute
    DictRemap := DictRemapings.Add;
    SourceDict := Attr.FindById("INDICATOR").ValuesObject;
    DictRemap.SourceId := SourceDict.Id;
    DictRemap.SourceKey := SourceDict.Key;
    DictRemap.Target := mb.ItemByIdNamespace("DICT_IND_COPY1", RepoCopy.Key);
    // Set correspondence for measurement units
    DictRemap := DictRemapings.Add;
    SourceDict := Attr.FindByKind(MetaAttributeKind.Unit).ValuesObject;
    DictRemap.SourceId := SourceDict.Id;
    DictRemap.SourceKey := SourceDict.Key;
    DictRemap.Target := mb.ItemByIdNamespace("UNITS_COPY1", RepoCopy.Key);
    RubUpdateEx.Apply(Progress);
End Sub UserProc;

After executing the example the FC time series database is copied to the root folder of the repository. Copy identifier - FC_COPY. The copy will save data in the MDM_REPO_COPY1 repository. Correspondences are set between dictionaries of this repository and the repository of the copied database.

See also:

ICubeMetaUpdateDictionaryRemapings