Add(New_:IDimHierarchy): IDimHierarchyInstance;
New. Alternative dictionary hierarchy.
The Add method adds additional alternative hierarchy in dimension.
To copy collection of additional alternative hierarchies from one dimension to another, use IDimAdditionalHierarchies.CopyFrom.
To clear collection of additional alternative hierarchies, use IDimAdditionalHierarchies.Clear.
To clear specified additional alternative hierarchy, use IDimAdditionalHierarchies.Remove, IDimAdditionalHierarchies.RemoveById, IDimAdditionalHierarchies.RemoveByKey.
Executing the example requires that the repository have:
MDM repository with the RDS identifier using the DIC_RF territory dictionary. Dictionary contains alternative hierarchy.
Express report with the EXPRESS identifier. Two data source dimensions of the report with the DIC_RFD and DIC_RFDR identifiers must correspond to the DIC_RF dictionary by number and identifiers of attributes.
Add links to the Dimensions, Express, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Slice: IEaxDataAreaSlice;
OriginDim: IDimensionModel;
Hiers: IDimHierarchies;
Hier: IDimHierarchy;
Sel, Sel_: IDimSelection;
AdditHiers, AdditHiers_: IDimAdditionalHierarchies;
HierInst: IDimHierarchyInstance;
Begin
// Get repository
MB := MetabaseClass.Active;
//Get structure of the main dictionary
OriginDim := MB.ItemByIdNamespace("DIC_RF", MB.ItemById("RDS").Key).Edit As IDimensionModel;
// Get dictionary hierarchy
Hiers := OriginDim.Hierarchies;
Hier := Hiers.Item(0);
// Get express report
Express := MB.ItemById("EXPRESS").Edit As IEaxAnalyzer;
// Get data slice
Slice := Express.DataArea.Slices.Item(0);
// Add alternative hierarchies to the dimension
Sel := Slice.Selection.FindById("DIC_RFD");
AdditHiers := Sel.AdditionalHierarchies;
HierInst := AdditHiers.Add(Hier);
Sel_ := Slice.Selection.FindById("DIC_RFDR");
AdditHiers_ := Sel.AdditionalHierarchies;
AdditHiers.CopyFrom(AdditHiers_);
// Refresh report and save changes
Express.RefreshAll;
(Express As IMetabaseObject).Save;
End Sub UserProc;
After executing the example additional alternative hierarchies will be added to the dimension.
See also: