It opens the dialog box to set up dimension filtering on determining calculation parameters of matrix aggregation models.
Command parameters are passed in the IUiCommandExecutionContext.Data property as an array of the Variant type, which elements contain values:
Value type | Description |
Element 1: IMsModel | Matrix aggregation model. |
Element 2: IMsAggregationFilter | Aggregation filter. |
The command is only applied to matrix aggregation model.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier including a matrix aggregation model with MODEL_AGGR identifier, and a form. Place the Button component on the form named Button1.
Add links to the Forms, Metabase, Ms, and Ui system assemblies.
The example is a handler of the OnClick event for the Button component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
Model: IMsModel;
Mt: IMsMatrixAggregationTransform;
Target: IUiCommandTarget;
Context: IUiCommandExecutionContext;
aArgs: array Of Variant;
Descr, RubrDescr: IMetabaseObjectDescriptor;
Param: IMsFormulaTransform;
Formula: IMsFormula;
Method: IMsMethod;
Begin
MB := MetabaseClass.Active;
// Get modeling container
RubrDescr := MB.ItemById("CONT_MODEL");
Descr:= RubrDescr.EditDescriptor;
// Get matrix aggregation model
Model := MB.ItemByIdNamespace("MODEL_AGGR", Descr.Key).Edit As IMsModel;
// Get model parameters
Param := Model.Transform;
// Get model calculation method
Formula := Param.FormulaItem(0);
// Get parameters of model calculation method
Method := Formula.Method;
Mt := Method As IMsMatrixAggregationTransform;
// Get the Ms plugin
Target := WinApplication.Instance.GetPluginTarget("Ms");
// Create a context for command execution
Context := Target.CreateExecutionContext;
// Create an array of command parameters
aArgs := New Variant[2];
aArgs[0] := Model;
aArgs[1] := Mt.Filter.Item(0);
Context.ParentWindow := self As IWin32Window;
Context.Modal := True;
// Pass array of command parameters
Context.Data := aArgs;
// Execute command
Target.Execute("EditMatrixAggregationFilter", Context);
// Save pending changes
(Model As IMetabaseObject).Save;
End Sub Button1OnClick;
After executing the example, clicking the Button1 button opens a dialog box to set up dimension filtering.
See also: