Article number: KB000002
Related blocks:
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:
Object.Open. Open an object.
Object.Edit. Edit object's properties.
Query.QueryBuilder. Call query builder.
Cube.SaveToFile. Open standard dialog box to save a cube to a file.
Cube.CreateReport. Create a regular report based on the cube.
CalcCube.EditFormulas. Open standard dialog box to edit formulas.
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.
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: