ForceHierarchy(Value: IDimHierarchiesInstance);
ForceHierarchy(Value: Prognoz.Platform.Interop.Dimensions.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 DIC_RF_AH identifier and a dictionary with the 71660 key. The DIC_RF_AH dictionary is considered as the main dictionary, 71660 is considered as an alternative hierarchy dictionary.
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.
The requirements and result of the Fore.NET example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
OriginalModelObj: IMetabaseObject;
dimInstance: IDimInstance;
H_Inst: IDimHierarchyInstance;
dimSel: IDimSelection;
Begin
// Get repository
Mb := Params.Metabase;
// 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;
See also:
Related work items
Defect 910593