IMatrixAggregatorModelHierarchies.AddValue

Syntax

AddValue(HierarchyKey: Integer, Value: IMatrixAggregatorModel);

AddValue(HierarchyKey: System.UInt32, Value: Prognoz.Platform.Interop.Matrix.IMatrixAggregatorModel);

Parameters

HierarchyKey. Key of dictionary in the collection of alternative hierarchies.

Value. Parameters of mechanism or method of aggregation by alternative hierarchy levels.

Description

The AddValue method adds existing aggregation parameters of dictionary alternative hierarchy by key.

Comments

The added parameters of dictionary alternative hierarchy are not displayed in the interface.

Example

Executing the example requires that repository contains a standard cube with the CUBE identifier.The dimension with the 1 index is used by 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;
    Dim: IStandardCubeDimension;
    Dest: IStandardCubeDestination;
    HierKey: Integer;
    Model: IMatrixAggregatorModel;
    Man: IMatrixAggregatorManager;
    BasicAggr: IBasicMatrixAggregator;
Begin
    MB := MetabaseClass.Active;
    
// Get cube for editing
    Cub := MB.ItemById("CUBE").Edit As IStandardCube;
    
// Get the first cube dimension
    Dim := Cub.Dimensions.Item(1);    
    
// Get parameters of cube display version
    Dest := Cub.Destinations.Item(0);
    
// Get list of alternative hierarchies
    Hiers := Dim.AggregatorHierarchies(1, Dest);    
    
// Create and set up data aggregator
    Man := New MatrixAggregatorManager.Create As IMatrixAggregatorManager;
    BasicAggr := Man.CreateAggregator(
"BasicMatrixAggregator"As IBasicMatrixAggregator;
    BasicAggr.UseSelection := 
True;
    BasicAggr.DefaultLevelAggregation.Operation := BasicAggregatorOperation.Sum;
    Model := BasicAggr 
As IMatrixAggregatorModel;
    
// Dictionary key in aggregation parameters of the first alternative hierarchy
    HierKey := Dim.Dimension.Hierarchies.Item(0).Key;    
    
// Change aggregation parameters
    Hiers.AddValue(HierKey, Model);
    
// Save changes in 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;
    Dim: IStandardCubeDimension;
    Dest: IStandardCubeDestination;
    HierKey: UInteger;
    Model: IMatrixAggregatorModel;
    Man: MatrixAggregatorManager = 
New MatrixAggregatorManagerClass();
    BasicAggr: IBasicMatrixAggregator;
Begin
    MB := Params.Metabase;
    
// Get cube for editing
    Cub := MB.ItemById["CUBE"].Edit() As IStandardCube;
    
// Get the first cube dimension
    Dim := Cub.Dimensions.Item[1];      
    
// Get parameters of cube display version
    Dest := Cub.Destinations.Item[0];
    
// Get list of alternative hierarchies
    Hiers := Dim.AggregatorHierarchies[1, Dest];        
    
// Create and set up data aggregator
    BasicAggr := Man.CreateAggregator("BasicMatrixAggregator"As IBasicMatrixAggregator;
    BasicAggr.UseSelection := 
True;
    BasicAggr.DefaultLevelAggregation.Operation := BasicAggregatorOperation.baoSum;
    Model := BasicAggr 
As IMatrixAggregatorModel;       
    
// Dictionary key in aggregation parameters of the first alternative hierarchy
    HierKey := Dim.Dimension.Hierarchies.Item[0].Key;
    
// Change aggregation parameters
    Hiers.AddValue(HierKey, Model);
    
// Save changes in cube
    (Cub As IMetabaseObject).Save();
End Sub;

After executing the example, in the standard cube with the CUBE identifier aggregation parameters of the first alternative hierarchy of the specified dimension will be added:

See also:

IMatrixAggregatorModelHierarchies