IDimSelection.ForceHierarchy

Fore Syntax

ForceHierarchy(Value: IDimHierarchiesInstance);

Fore.NET Syntax

ForceHierarchy(Value: Prognoz.Platform.Interop.Dimensions.IDimHierarchiesInstance);

Parameters

Valule. Alternative hierarchy source.

Description

The ForceHierarchy method sets an alternative hierarchy in the selection.

Comments

Any other dictionary can be used as an alternative hierarchy source.

Fore Example

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(NullAs IDimInstance;
    dimSel := dimInstance.CreateSelection;
    // Get alternative hierarchy source
    H_Inst := dimInstance.Hierarchies.FindByKey(71660As 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.

Fore.NET Example

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(NullAs IDimInstance;
    dimSel := dimInstance.CreateSelection();
    // Get alternative hierarchy source
    H_Inst := dimInstance.Hierarchies.FindByKey(71660As IDimHierarchyInstance;
    // Set  alternative hierarchy
    dimSel.ForceHierarchy(H_Inst);
    // Save dictionary
    OriginalModelObj.Save();
End Sub;

See also:

IDimSelection

Related work items

Defect 910593