EditDictionaryAttribute Command

Purpose

Opens a dialog box for editing attribute parameters of MDM dictionary.

Parameters of Use

Command parameters are passed in the Data property. Executing the command requires to specify the following value in this property:

Value type Description
IRdsAttribute The dictionary attribute that must be opened for edit.

Application Features

The command can be executed only for MDM dictionary attributes (composite or table MDM dictionaries). The Execute method execution results in the True value if the OK button was clicked in the dialog box, and the False value if the Cancel button was clicked in the dialog box.

Fore Example

Executing the example requires a form and a button named Button1 on the form. The repository contains a MDM repository with the NSI_1 identifier and this repository contains a Dict_1 dictionary. The attribute with the COUNTRY_ID identifier is a part of a dictionary structure.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    Dictionary: IRdsDictionary;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    bOK: Boolean;
Begin
    MB := MetabaseClass.Active;
    Dictionary := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Edit As IRdsDictionary;
    Target := WinApplication.Instance.GetPluginTarget("Rds");
    Context := Target.CreateExecutionContext;
    Context.Data := Dictionary.Attributes.FindById("COUNTRY_ID");
    bOK := Target.Execute("EditDictionaryAttribute", Context);
    If bOK Then
        (Dictionary As IMetabaseObject).Save;
    End If;
    text := bOK.ToString;
End Sub Button1OnClick;

Edit dialog box of the selected MDM dictionary opens by clicking the button. All the changes are saved if any of parameters are changed in the dialog box or if the OK button is clicked.

Fore.NET Example

Executing the example requires a form and a button named Button1 on the form. The repository contains a MDM repository with the NSI_1 identifier and this repository contains a Dict_1 dictionary. The attribute with the COUNTRY_ID identifier is a part of a dictionary structure.

Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.Ui;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    MB: IMetabase;
    Dictionary: IRdsDictionary;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    WinApp: WinApplicationClassClass = New WinApplicationClassClass();
    RunContext: ForeRuntimeContext;
    bOK: Boolean;
Begin
    MB := Self.Metabase;
    RunContext := (MB As IForeServices).GetRuntime().Context;
    Dictionary := MB.ItemByIdNamespace["Dict_1", MB.ItemById["NSI_1"].Key].Edit() As IRdsDictionary;
    Target := WinApp.Instance[RunContext].GetPluginTarget("Rds");
    Context := Target.CreateExecutionContext();
    Context.Data := Dictionary.Attributes.FindById("COUNTRY_ID");
    bOK := convert.ToBoolean(Target.Execute("EditDictionaryAttribute", Context, RunContext));
    If bOK Then
        (Dictionary As IMetabaseObject).Save();
    End If;
End Sub;

Edit dialog box of the selected MDM dictionary opens by clicking the button. All the changes are saved if any of parameters are changed in the dialog box or if the OK button is clicked.

See also:

IUiCommandTarget.Execute