AggregatorHierarchies(Destination: IAutoCubeDestination): IMatrixAggregatorModelHierarchies
AggregatorHierarchies[Destination: Prognoz.Platform.Interop.Cubes.IAutoCubeDestination]: Prognoz.Platform.Interop.Matrix.IMatrixAggregatorModelHierarchies
Destination. Cube display version for which aggregation by alternative hierarchy levels must be set up.
The AggregatorHierarchies property determines aggregation settings by levels of alternative hierarchy for the specified cube display option.
Executing the example requires that the repository contains an automatic cube with the CUBE identifier. The first dimension uses the dictionary with configured alternative hierarchy.
Add links to the Metabase, Cubes, Dimensions, Matrix system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Cub: IAutoCube;
Hiers: IMatrixAggregatorModelHierarchies;
AggHier: IBasicMatrixAggregator;
Dim: IAutoCubeDimension;
Dest: IAutoCubeDestination;
HierKey: Integer;
Begin
MB := MetabaseClass.Active;
// Get cube for edit
Cub := MB.ItemById("CUBE").Edit As IAutoCube;
// Get the first cube dimensions
Dim := Cub.Dimensions.Item(0);
// Get parameters of cube display version
Dest := Cub.Destinations.Item(0);
// Get the list of alternative hierarchies
Hiers := Dim.AggregatorHierarchies(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: IAutoCube;
Hiers: IMatrixAggregatorModelHierarchies;
AggHier: IBasicMatrixAggregator;
Dim: IAutoCubeDimension;
Dest: IAutoCubeDestination;
HierKey: UInteger;
Begin
MB := Params.Metabase;
// Get cube for edit
Cub := MB.ItemById["CUBE"].Edit() As IAutoCube;
// Get the first cube dimensions
Dim := Cub.Dimensions.Item[0];
// Get parameters of cube display version
Dest := Cub.Destinations.Item[0];
// Get the list of alternative hierarchies
Hiers := Dim.AggregatorHierarchies[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: