In this article:

General Information

Description

Example

Executing Standard Operations with Repository Objects

Article number: KB000002

General Information

Related blocks:

Description

All repository object support standard operations like opening or editing. Also each objects' class may support operations specific for this class. For example, a calculated cube supports formula editing. Commands required to perform all available operations on an object, are included into the context menu that is called for the object from object navigator. Each of these operation can be performed from code of application system.

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 perform an operation on an object call the Execute method. Specify string identifier of the command and context of execution (if required) beforehand. Context of execution is required to define context in which command execution is to take place: parent form, execution mode and parameters. The user can create context of execution for a command by calling the method CreateExecutionContext. Use the IUiCommandExecutionContext.Data property to pass a parameter value to execute a parameterized command. The result of command execution is returned by Execute (generally returns an empty value).

All commands have a unique string identifier. For example the command used to open an object has the identifier Object.Open, the command for editing an object has the identifier Object.Edit 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 object Ui.WinApplication.Instance. 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