Opens the dialog box to set up multidimensional cycle or the dialog box to set up multidimensional cycle dimension.
Command parameters are passed in the IUiCommandExecutionContext.Data property as an array of the Variant type which elements contain the following values:
Value type | Description |
Element 1: IMsMetaModel | Metamodel containing a multidimensional cycle. |
Element 2: IMsCalculationChainEntry | Calculation chain element that is a multidimensional cycle. |
Element 3: IMsDimIteratorDimension | Multidimensional cycle dimension. |
Element 4: String | It can be set only to the compact value. The attribute that a short dialog box view to set up dimension filtering will be displayed. |
The dialog box display depends on the selected array elements. If:
Two first elements are set. The dialog box to set up multidimensional cycle is displayed.
Three first elements are displayed. The dialog box to set up multidimensional cycle dimension specified in the third element is displayed. The dialog box is full and contains the tabs: Filter, Linked Dimensions, Data Sources.
All elements are set. The dialog box to set up multidimensional cycle dimension specified in the third element is displayed. The dialog box is short and contains only the Filter tab.
Executing the example requires a form that contains a button with the Button1 identifier and three components RadioButton with the RadioButton1, RadioButton2, RadioButton3 identifiers. In the RadioButton1 component the Checked property is set to True. The Text property has the following values for the RadioButton components:
RadioButton1. Multidimensional cycle.
RadioButton2. Dimension setup (full).
RadioButton3. Dimension setup (short).
Executing the example requires that the repository contains a modeling container with the MS_PLUGIN identifier including metamodel with the META_DIMITERATOR identifier. This metamodel contains only multidimensional cycle calculated by several dimensions.
Add links to the Fore, Metabase, Ms, UI system assemblies.
The example is an event handler of the OnClick event for the Button1 button.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
mb: IMetabase;
msKey: Integer;
meta: IMsMetaModel;
chainEntry: IMsCalculationChainEntry;
dimIter: IMsCalculationChainMultiDimIterator;
target: IUiCommandTarget;
context: IUiCommandExecutionContext;
arg: array Of Variant;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get model
msKey := mb.GetObjectKeyById("MS_PLUGIN");
meta := mb.ItemByIdNamespace("META_DIMITERATOR", msKey).Edit As IMsMetaModel;
// Get multidimensional cycle
chainEntry := meta.CalculationChain.Item(0);
dimIter := chainEntry As IMsCalculationChainMultiDimIterator;
// Get Ms plugin
target := WinApplication.Instance.GetPluginTarget("Ms");
// Create a context to execute a command
context := target.CreateExecutionContext;
// Create command parameters array
arg := New Variant[4];
arg[0] := meta;
arg[1] := chainEntry;
// If the RadioButton2 radio button is selected,
// an element with multidimensional cycle dimension is added to the array
If RadioButton2.Checked Then
arg[2] := dimIter.Dimensions.Item(0);
End If;
// If the RadioButton2 radio button is selected,
// an element with multidimensional cycle dimension is added to the array
// and an element specifying the short view of dialog box
If RadioButton3.Checked Then
arg[2] := dimIter.Dimensions.Item(0);
arg[3] := "compact";
End If;
// Send command parameters array
context.Data := arg;
// Execute the command
target.Execute("EditChainEntry", context);
End Sub Button1OnClick
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Ui;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
mb: IMetabase;
msKey: uinteger;
meta: IMsMetaModel;
chainEntry: IMsCalculationChainEntry;
dimIter: IMsCalculationChainMultiDimIterator;
target: IUiCommandTarget;
WinApp: WinApplicationClassClass = New WinApplicationClassClass();
RunContext: ForeRuntimeContext;
context: IUiCommandExecutionContext;
arg: array Of object;
Begin
// Get current repository
mb := Self.Metabase;
// Get model
msKey := mb.GetObjectKeyById("MS_PLUGIN");
meta := mb.ItemByIdNamespace["META_DIMITERATOR", msKey].Edit() As IMsMetaModel;
// Get multidimensional cycle
chainEntry := meta.CalculationChain.Item[0];
dimIter := chainEntry As IMsCalculationChainMultiDimIterator;
// Get Ms plugin
RunContext := (mb As IForeServices).GetRuntime().Context;
target := WinApp.Instance[RunContext].GetPluginTarget("Ms");
// Create a context to execute a command
context := target.CreateExecutionContext();
// Create command parameters array
arg := New object[4];
arg[0] := meta;
arg[1] := chainEntry;
// If the RadioButton2 radio button is selected,
// an element with multidimensional cycle dimension is added to the array
If RadioButton2.Checked Then
arg[2] := dimIter.Dimensions.Item[0];
End If;
// If the RadioButton2 radio button is selected,
// an element with multidimensional cycle dimension is added to the array
// and an element specifying the short view of dialog box
If RadioButton3.Checked Then
arg[2] := dimIter.Dimensions.Item[0];
arg[3] := "compact";
End If;
// Send command parameters array
context.Data := arg;
// Execute the command
target.Execute("EditChainEntry", context, RunContext);
End Sub;
After executing the example, clicking the Button1 button launches the behavior that depends on the selected RadioButton radio buttons:
RadioButton1. The dialog box to set up multidimensional cycle is displayed.
RadioButton2. The full dialog box to set up the first dimension of multidimensional cycle.
RadioButton3. The short dialog box to set up the first dimension of multidimensional cycle.
See also: