ICubeMetaUpdateDictionaryRemapings.Clear

Syntax

Clear;

Description

The Clear method clears 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 factors. 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 Main;

Var

mb: IMetabase;

RubUpdateEx: ICubeMetaUpdateEx;

Rub: IRubricator;

Progress: IMetabaseUpdateProgress;

CrInfo: IMetabaseObjectCreateInfo;

s: string;

DictRemapings: ICubeMetaUpdateDictionaryRemapings;

DictRemap: ICubeMetaUpdateDictionaryRemaping;

Attr: IMetaAttributes;

RepoCopy, SourceDict: IMetabaseObjectDescriptor;

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 to 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 to 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 to the 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 Main;

After executing the example the FC time series database is copied to the repository root. The identifier of the copy is FC_COPY. The copy saves 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