It opens the dialog box for setting up basic aggregation mechanism.
Command parameters are passed in the IUiCommandExecutionContext.Data property. Executing the command requires to specify an array of the Variant type in the property, the elements of this array contain the following values:
Value type | Description |
Element 1: IMatrixAggregatorModel | Settings of basic aggregation mechanism. |
Element 2: IDimensionModel | Dictionary structure - cube dimension. |
Element 3: IStandardCubeDestination | Cube display version. |
Element 4: IDimLevel | Dictionary level. |
To execute the example, place the Button component named Button1 on the form. The repository must contain a standard cube with the STD_CUBE identifier.
Add links to the Cubes, Dimensions, Forms, Matrix, Metabase, and Ui system assemblies.
The example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
Cube: IStandardCube;
DimModel: IDimensionModel;
Dim: IStandardCubeDimension;
Destination: IStandardCubeDestination;
Model: IMatrixAggregatorModel;
Data: Array;
Target: IUiCommandTarget;
Context: IUiCommandExecutionContext;
Begin
// Get the current repository
MB := MetabaseClass.Active;
// Get standard cube
Cube := MB.ItemById("STD_CUBE").Edit As IStandardCube;
// Get the first cube display version
Destination := Cube.Destinations.Item(0);
// Get the first cube dimension and its structure
Dim := Destination.Dimensions.Item(1);
DimModel := Dim.Dimension;
// Set dimension aggregation parameters by cube fact
Model:= Dim.Aggregator(1, Destination);
Data := New Variant[4];
Data[0]:= Model;
Data[1]:= DimModel;
Data[2]:= Destination;
Data[3]:= DimModel.Levels.Item(1);
// Open dialog box for setting up basic aggregation mechanism
Target := WinApplication.Instance.GetPluginTarget("Cubes");
Context := Target.CreateExecutionContext;
Context.Data := Data;
// Execute command for object
Target.Execute("SetupAggregations", Context);
// Save changes
(Cube As IMetabaseObject).Save;
End Sub Button1OnClick;
After executing the example, clicking the button opens the <dimension name> - Basic aggregation mechanism dialog box for setting up basic aggregation mechanism. If any changes are made in the dialog box and the OK button is clicked, all changes are saved.
See also: