IUiMetabaseObject.OperationMode

Syntax

OperationMode: UiMetabaseObjectOperationMode;

Description

The OperationMode property determines mode of object connection.

Comments

If the property is set to External, specify an open object instance in the Instance property. On activating the component the specified object is not reopened and is available as it is.

Example 1

Executing the example requires a form with the Button1 button and the UiErAnalyzer component named UiErAnalyzer1. An express object was loaded into UiErAnalyzer1. The components used for express object editing are also placed on the form.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    ExspressReport: IEaxAnalyzer;
Begin
    If UiErAnalyzer1.OperationMode = UiMetabaseObjectOperationMode.Open Then
        MB := MetabaseClass.Active;
        CrInfo := MB.CreateCreateInfo;
        CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
        CrInfo.Id := "Copy_" + UiErAnalyzer1.Object.Id;
        CrInfo.Parent := MB.Root;
        ExspressReport := MB.CreateObject(CrInfo).Edit As IEaxAnalyzer;
        ExspressReport.CopyFrom(UiErAnalyzer1.Instance As IEaxAnalyzer);
        (ExspressReport As IMetabaseObject).Save;
    Else
        (UiErAnalyzer1.Instance As IMetabaseObject).Save;
    End If;
End Sub Button1OnClick;

After clicking the button the copy of the report with all made changes is created and saved in the repository root if the report loaded into UiErAnalyzer1 is connected without ability to save changes into the initial object.

Example 2

Executing the example requires a form with the Button1 button and the UiErAnalyzer component named UiErAnalyzer1. The components used for express object editing are also placed on the form.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    ExpressReport: IEaxAnalyzer;
Begin
    //...
    ExpressReport := //...Getting an instance of opened express report
    //...
    //Various operations for preliminary setup of express report
    //...
    //Connecting report for getting access  it on the form
    UiErAnalyzer1.OperationMode := UiMetabaseObjectOperationMode.External;
    UiErAnalyzer1.Instance := ExpressReport;
    UiErAnalyzer1.Active := True;
End Sub Button1OnClick;

This example shows general mechanism of connecting the External object based on the example of connecting an opened instance of express report. If the Active property is set to True, the report is not reopened.

See. also:

IUiMetabaseObject