ForceHierarchy(Value: IDimHierarchiesInstance);
Valule. Alternative hierarchy source.
The ForceHierarchy method sets an alternative hierarchy in the selection.
Any other dictionary can be used as an alternative hierarchy source.
Executing the example requires that the repository contains a dictionary with the DICT_RF_AH identifier and a dictionary with the 71660 key. The DIC_RF_AH dictionary is considered as the main one, the 71660 dictionary is considered as a dictionary for alternative hierarchy.
Add links to the Dimension, Metabase system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
OriginalModelObj: IMetabaseObject;
dimInstance: IDimInstance;
H_Inst: IDimHierarchyInstance;
dimSel: IDimSelection;
Begin
// Get repository
Mb := MetabaseClass.Active;
// Get dictionary
OriginalModelObj := Mb.ItemById("DIC_RF_AH").Edit;
dimInstance := OriginalModelObj.Open(Null) As IDimInstance;
dimSel := dimInstance.CreateSelection;
// Get alternative hierarchy source
H_Inst := dimInstance.Hierarchies.FindByKey(71660) As IDimHierarchyInstance;
// Set alternative hierarchy
dimSel.ForceHierarchy(H_Inst);
// Save dictionary
OriginalModelObj.Save;
End Sub UserProc;
After executing the example an alternative hierarchy is set for the selection.
See also: