AggregatorHierarchies(FactKey: Variant; Destination: IStandardCubeDestination): IMatrixAggregatorModelHierarchies;
FactKey. Value of the primary key of the fact dimension element, for which one should set up aggregation by alternative hierarchy;
Destination. Cube display version for which aggregation must be set.
The AggregatorHierarchies property determines aggregation settings by levels of alternative hierarchy levels for the specified cube fact.
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 Cubes, Dimensions, Matrix, and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
StdCube: IStandardCube;
Hiers: IMatrixAggregatorModelHierarchies;
AggHier: IBasicMatrixAggregator;
Dim: IStandardCubeDimension;
Dest: IStandardCubeDestination;
HierKey: Integer;
Begin
MB := MetabaseClass.Active;
// Get cube for editing
StdCube := MB.ItemById("CUBE").Edit As IStandardCube;
// Get cube display version parameters
Dest := StdCube.Destinations.Item(0);
// Get the first cube dimension
Dim := Dest.Dimensions.Item(1);
// Get 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 in cube
(StdCube As IMetabaseObject).Save;
End Sub UserProc;
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: