Object.Open Command

Purpose

Opens an object.

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
IMetabaseObjectParamValues Parameter values, which will be used to open an object.

Application Features

The command can be used only for the objects that support opening. Parameters for the command are passed if the object contains advanced parameters. Value of the Silent property is also taken into account when opening an object.

Example 1

Executing the example requires a form, a button on this form named Button1 and a repository object with the Table_1 identifier, which supports object opening.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        Mb: IMetabase;
        ObjDes: IMetabaseObjectDescriptor;
        Target: IUiCommandTarget;
    Begin
        MB := MetabaseClass.Active;
        ObjDes := MB.ItemById("Table_1");
        Target := WinApplication.Instance.GetObjectTarget(ObjDes);
        Target.Execute("Object.Open"Null);
    End Sub Button1OnClick;

Clicking the button opens an object with the Table_1 identifier.

Example 2

Executing the example requires a form, a button on this form named Button1 and a repository object with the Query_1 identifier, which supports object opening and contains an advanced parameter.

    Sub Button1OnClick(Sender: Object; Args: IEventArgs);
    Var
        Mb: IMetabase;
        ObjDes: IMetabaseObjectDescriptor;
        Params: IMetabaseObjectParamValues;
        Target: IUiCommandTarget;
        Context: IUiCommandExecutionContext;
    Begin
        MB := MetabaseClass.Active;
        ObjDes := MB.ItemById("Query_1");
        Params := ObjDes.Params.CreateEmptyValues;
        Params.Item(0).Value := 200;
        Target := WinApplication.Instance.GetObjectTarget(ObjDes);
        Context := Target.CreateExecutionContext;
        Context.Data := Params;
        Target.Execute("Object.Open", Context);
    End Sub Button1OnClick;

Clicking the button opens an object with the Query_1 identifier. Object parameter value is set to 200.

Example 3

Executing the example requires a form, a button on this form named Button1 and a repository object with the Query_1 identifier, which supports object opening and contains advanced parameters.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        Mb: IMetabase;
        ObjDes: IMetabaseObjectDescriptor;
        Target: IUiCommandTarget;
        Context: IUiCommandExecutionContext;
    Begin
        MB := MetabaseClass.Active;
        ObjDes := MB.ItemById("Query_1");
        Target := WinApplication.Instance.GetObjectTarget(ObjDes);
        Context := Target.CreateExecutionContext;
        Context.ExecutionMode := UiCommandExecutionMode.PromptUser;
        Target.Execute("Object.Open", Context);
    End Sub Button1OnClick;

Clicking the button opens an object with the Query_1 identifier. A dialog box that is used to set object parameters opens before opening.

See also:

IUiCommandTarget.Execute