Open the dialog box to set values of additional attributes.
Command parameters are passed in the IUiCommandExecutionContext.Data property. Executing the command requires to specify the following values in the property:
Value type | Description |
Element 1: IMsModel | Standard model. |
Element 2: IRubricator | Time series database. |
The Attribute Values dialog box can be opened for standard models if a time series database is a data source for output variable.
Executing the example requires a form containing a button with the Button1 identifier.
It is required that the repository contains a modeling container with the MS_PLUGIN identifier containing a standard model with the DIMITERATOR identifier. A data source for output variable is a time series database with the TSDB identifier.
Add links to the Cubes, Fore, Metabase, Ms, UI system assemblies.
The example is a handler of the OnClick event for the Button1 button.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Mb: IMetabase;
MsKey: Integer;
Model: IMsModel;
Rubricator: IRubricator;
Target: IUiCommandTarget;
Context: IUiCommandExecutionContext;
Arg: array Of Variant;
Begin
// Get current repository
Mb := MetabaseClass.Active;
// Get model
MsKey := Mb.GetObjectKeyById("MS_PLUGIN");
Model := Mb.ItemByIdNamespace("DIMITERATOR", MsKey).Edit As IMsModel;
// Get time series database
Rubricator := Mb.ItemById("TSDB").Edit As IRubricator;
// 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[2];
Arg[0] := Rubricator;
Arg[1] := Model;
// Send command parameters array
Context.Data := Arg;
// Execute the command
Target.Execute("ShowAdditionalAttributesDialog", Context);
End Sub Button1OnClick;
Imports Prognoz.Platform.Interop.Cubes;
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;
MObj: IMetabaseObject;
MsKey: uinteger;
Model: IMsModel;
Rubricator: IRubricator;
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");
Model := Mb.ItemByIdNamespace["DIMITERATOR", MsKey].Edit() As IMsModel;
// Get time series database
Rubricator := Mb.ItemById["TSDB"].Edit() As IRubricator;
// 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[2];
Arg[0] := Rubricator;
Arg[1] := Model;
// Send command parameters array
Context.Data := Arg;
// Execute the command
Target.Execute("ShowAdditionalAttributesDialog", Context, RunContext);
End Sub;
After executing the example, clicking the Button1 button opens a dialog box to set values of additional attributes.
See also: