In this article:

General Information

Description

Example

Executing Standard Operations with Repository Objects

Article number: KB000002

General Information

Related blocks:

Description

All repository objects support standard operations like opening or editing. Each objects' class may also support operations specific for this class. For example, a calculated cube supports formula editing. Commands required to execute all available operations with an object are included in the context menu that is opened for the object from the object navigator. Each of these operations can be executed from application system code.

Foresight Analytics Platform objects that support executing of operations with them have the Ui.IUiCommandTarget interface:

Interface IUiCommandTarget
    Function CreateExecutionContext: IUiCommandExecutionContext;
    Function Execute(Command: String; Context: IUiCommandExecutionContext): Variant;

To execute an operation with an object, call the Execute method. Specify string identifier of the command and context of execution (if required) beforehand. Execution context is required to define the environment, in which command execution takes place: parent form, execution mode and parameters. The user can create context of execution for a command by calling the CreateExecutionContext method. Use the IUiCommandExecutionContext.Data property to pass a parameter value to execute a parameterized command. The result of command execution is returned by the Execute method (generally returns an empty value).

All commands have a unique string identifier. For example the command used to open an object has the Object.Open identifier, the command for editing an object has the Object.Edit identifier, and so on. The list of basic standard commands:

It is available to execute a command for a repository object by getting the IUiCommandTarget interface. It is returned by the GetObjectTarget method called for an instance of the Ui.WinApplication.Instance object. Next, call the IUiCommandTarget.Execute method with required parameters.

Example

Sub Sample;
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 Sample;

See also:

Developers Knowledge Base