SourceKey: Integer;
The SourceKey property determines a key of the indicators attribute of copied database that is used as a data source for the indicators attribute of the database copy.
Time series attributes of the copied database and time series attributes of the database copy can be bound in the following ways:
Using the attribute identifier: the ICubeMetaUpdateAttributeRemapping.Source property.
Using the attributes keys: the SourceKey property.
Using both the key and the attribute identifier.
If only attribute ID used to bind fields, some errors may occur during the copying if the attribute ID in time series database has been changed. Binding with using the attribute key is more safe.
Executing the example requires that the repository contains a time series database with the FC identifier that contains a custom indicators attribute COUNTRY. The repository should also contain a time series database with the FC_COPY identifier that contains a custom indicators attribute A_COUNTRY. These attributes must have the same characteristics.
Add links to the Cubes, Metabase, and Rds system assemblies.
Sub UserProc;
Var
mb: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
Obj: IMetabaseObject;
ObjDesc: IMetabaseObjectDescriptor;
RubUpdateEx: ICubeMetaUpdateEx;
Rub: IRubricator;
AttrRemapping: ICubeMetaUpdateAttributeRemappings;
AttrR: ICubeMetaUpdateAttributeRemapping;
FactsDict: IMetaDictionary;
Attr: IMetaAttribute;
Begin
mb := MetabaseClass.Active;
CrInfo := Mb.CreateCreateInfo;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_CUBEMETAUPDATE;
CrInfo.Id := Mb.GenerateId("Cube_Meta_Upd");
CrInfo.Permanent := True;
CrInfo.Parent := Mb.Root;
ObjDesc := Mb.CreateObject(CrInfo);
Obj := ObjDesc.Edit;
RubUpdateEx := Obj As ICubeMetaUpdateEx;
Rub := mb.ItemById("FC").Bind As IRubricator;
RubUpdateEx.Rubricator := Rub;
RubUpdateEx.Metabase := Mb;
RubUpdateEx.RdsDatabase := Rub.Database;
RubUpdateEx.TargetRubricator := mb.ItemById("FC_COPY").Bind As IRubricator;
AttrRemapping := RubUpdateEx.MetafactsAttributeRemappings;
AttrR := AttrRemapping.FindById("A_COUNTRY");
AttrR.Source := "COUNTRY";
FactsDict := Rub.Facts;
Attr := FactsDict.Attributes.FindById("COUNTRY");
AttrR.SourceKey := Attr.Key;
AttrR.Type := CubeMetaUpdateAttributeRemappingType.Source;
Obj.Save;
End Sub UserProc;
After executing the example the correspondence by key and identifier is set for the A_COUNTRY and the COUNTRY attributes: when copying data from the FC database to the FC_COPY database, data of the COUNTRY attribute is copied to the A_COUNTRY attribute. The object that contains copying settings is saved with the Cube_Meta_Upd identifier.
See also: