IMetabaseObjectDescriptor.Open

Fore Syntax

Open(Params: IMetabaseObjectParamValues): IMetabaseObjectInstance;

Fore.NET Syntax

Open(Params: Prognoz.Platform.Interop.Metabase.IMetabaseObjectParamValues): Prognoz.Platform.Interop.Metabase.IMetabaseObjectInstance;

Parameters

Params. Value of the parameter, which is used on opening the object. If the object has no parameters, the Null value should be passed.

Description

The Open method opens the object and returns its data.

Comments

The Open method creates an object instance, but does not open it in the interface. The method is used only to open forms. To open other repository objects, run the Object.Open command.

Fore Examples

Example of opening a form

Executing the example requires that the repository contains a form with the Form_open identifier.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("Form_open").Bind;
    MObj.Open(Null);
End Sub UserProc;

After executing the example a form is opened.

Example of opening a macro

Executing the example requires that repository contains a query with the Query_ identifier. This query is created with two parameters.

Add links to the Metabase, MDb system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Params: IMetabaseObjectParamValues;
    Inst: IDatasetInstance;
    Fields: IDatasetInstanceFields;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("Query_").Bind;
    Params := MObj.ParamValues;
    Params.Item(0).Value := 100;
    Params.Item(1).Value := 300;
    Inst := MObj.Open(Params) As IDatasetInstance;
    Fields := Inst.Fields;
    While Not Inst.Eof Do
        Debug.WriteLine(Fields.Item(0).Value);
        Inst.Next;
    End While;
End Sub UserProc;

After executing the example the query with the specified values of parameters is opened. Values of the first data column received while execution of the query are displayed in the development environment console.

Fore.NET Examples

Example of opening a form

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemById["Form_open"].Bind();
    MObj.Open(Null);
End Sub;

Example of opening a macro

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Db;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Param: IMetabaseObjectParamValues;
    Inst: IDatasetInstance;
    Fields: IDatasetInstanceFields;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemById["Query_"].Bind();
    Param := MObj.ParamValues;
    Param.Item[0].Value := 100;
    Param.Item[1].Value := 300;
    Inst := MObj.Open(Param) As IDatasetInstance;
    Fields := Inst.Fields;
    While Not Inst.Eof() Do
        System.Diagnostics.Debug.WriteLine(Fields.Item[0].Value);
        Inst.Next();
    End While;
End Sub;

See also:

IMetabaseObjectDescriptor