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.
Executing the example requires that the repository contains a standard cube with the CUBE identifier. The dimension with the 1 index uses the dictionary with configured 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);
// Add aggregation settings for alternative hierarchy dictionary
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];
// Add aggregation settings for alternative hierarchy dictionary
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, aggregation parameters for the first alternative hierarchy of the specified dimension are added in the cube:
Aggregation of selected elements in dimension will be enabled.
Aggregation method will be changed to sum.
See also: