Show contents 

Cubes > Cubes Assembly Interfaces > ICubeMetaUpdateEx > ICubeMetaUpdateEx.DictionaryRemapings

ICubeMetaUpdateEx.DictionaryRemapings

Syntax

DictionaryRemapings: ICubeMetaUpdateDictionaryRemapings;

Description

The DictionaryRemapings property returns the collection of correspondences between objects of the copied time series database and objects of database copy.

Comments

If a time series database is copied from one repository to another, the MDM dictionaries in the consumer repository must be the clones of the source repository's dictionaries.

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 time series. Attributes are 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:

ICubeMetaUpdateEx