Open(Params: IMetabaseObjectParamValues): IMetabaseObjectInstance;
Params. Values of the parameter, which is used on opening the object. If the object has no parameters, the Null value should be passed.
The Open method opens the object and returns its data.
The Open method creates an object instance, but does not open it in the visual interface. Only forms will be opened in visual interface. To open visual interface of other repository objects, use the following command: Object.Open.
On opening parametric objects, the collection to specify parameter values can be obtained using the IMetabaseObjectParams.CreateEmptyValues method.
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;
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;
After executing the example a form is opened.
Executing the example requires that the repository contains a query with the Query_1 identifier. This query is created with two parameters.
Add links to the Db and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Params: IMetabaseObjectParamValues;
Inst: IDatasetInstance;
Fields: IDatasetInstanceFields;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("Query_1");
Params := MObj.Params.CreateEmptyValues;
Params.Item(0).Value := 100;
Params.Item(1).Value := 300;
//Open query
Inst := MObj.Open(Params) As IDatasetInstance;
Fields := Inst.Fields;
//View values
While Not Inst.Eof Do
Debug.WriteLine(Fields.Item(0).Value);
Inst.Next;
End While;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Param: IMetabaseObjectParamValues;
Inst: IDatasetInstance;
Fields: IDatasetInstanceFields;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["Query_1"];
Param := MObj.Params.CreateEmptyValues();
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;
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.
See also: