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 parameters of dictionary alternative hierarchy by key.

Comments

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

Example

To execute the example, make sure that the repository contains a standard cube with the CUBE identifier, which uses dictionaries as 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;
    
// Get alternative hierarchy settings of the first dictionary in the list
    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;       
    
// Get alternative hierarchy settings of the first dictionary in the list
    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, new parameters of the first alternative hierarchy dictionary will be added to the standard cube with the CUBE identifier:

See also:

IMatrixAggregatorModelHierarchies