AggregatorHierarchies(FactKey: Variant; Destination: IStandardCubeDestination): IMatrixAggregatorModelHierarchies
AggregatorHierarchies[FactKey: System.Object, Destination: Prognoz.Platform.Interop.Cubes.IStandardCubeDestination]: Prognoz.Platform.Interop.Matrix.IMatrixAggregatorModelHierarchies
FactKey. Key of the facts dimension element, for which aggregation must be set up by levels of alternative hierarchy
Destination. Cube display version for which aggregation must be set.
The AggregatorHierarchies property determines aggregation settings by levels of alternative hierarchy for the specified dimension of cube facts.
To execute the example, make sure that the repository contains a standard cube with the CUBE identifier that uses dictionaries as alternative hierarchy.
Add links to the Metabase, Cubes, Dimensions, Matrix system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Cub: IStandardCube;
Hiers: IMatrixAggregatorModelHierarchies;
AggHier: IBasicMatrixAggregator;
Dim: IStandardCubeDimension;
Dest: IStandardCubeDestination;
HierKey: Integer;
Begin
MB := MetabaseClass.Active;
// Get cube for edit
Cub := MB.ItemById("CUBE").Edit As IStandardCube;
// Get the first cube dimensions
Dim := Cub.Dimensions.Item(1);
// Get parameters of cube display version
Dest := Cub.Destinations.Item(0);
// Get the list of alternative hierarchies
Hiers := Dim.AggregatorHierarchies(1, Dest);
// Get settings of alternative hierarchy of the first dictionary in the list
HierKey := Dim.Dimension.Hierarchies.Item(0).Key;
AggHier := Hiers.Add(HierKey) As IBasicMatrixAggregator;
// Change aggregation parameters
AggHier.UseSelection := True;
AggHier.DefaultLevelAggregation.Operation := BasicAggregatorOperation.Sum;
// Save changes to cube
(Cub As IMetabaseObject).Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Cub: IStandardCube;
Hiers: IMatrixAggregatorModelHierarchies;
AggHier: IBasicMatrixAggregator;
Dim: IStandardCubeDimension;
Dest: IStandardCubeDestination;
HierKey: UInteger;
Begin
MB := Params.Metabase;
// Get cube for edit
Cub := MB.ItemById["CUBE"].Edit() As IStandardCube;
// Get the first cube dimensions
Dim := Cub.Dimensions.Item[1];
// Get parameters of cube display version
Dest := Cub.Destinations.Item[0];
// Get the list of alternative hierarchies
Hiers := Dim.AggregatorHierarchies[1, Dest];
// Get settings of alternative hierarchy of the first dictionary in the list
HierKey := Dim.Dimension.Hierarchies.Item[0].Key As UInteger;
AggHier := Hiers.Add(HierKey) As IBasicMatrixAggregator;
// Change aggregation parameters
AggHier.UseSelection := True;
AggHier.DefaultLevelAggregation.Operation := BasicAggregatorOperation.baoSum;
// Save changes to cube
(Cub As IMetabaseObject).Save();
End Sub;
After executing the example on setting up data aggregation of standard cube with the CUBE identifier, there will be a change of parameters of the first dictionary of alternative hierarchy:
Aggregation of selected elements in dimension will be enabled.
Aggregation method will be changed to sum.
See also: