Open(Params: IMetabaseObjectParamValues): IDatasetInstance;
Open(Params: Prognoz.Platform.Interop.Metabase.IMetabaseObjectParamValues): Prognoz.Platform.Interop.Db.IDatasetInstance;
Params. Data source parameters. Null if parameters are absent.
The Open method opens a data source.Values of data source parameters are passed by Params.
To open and close a data source using filter, use the IDatasetModel.OpenWhere method.
Executing the example requires that the repository contains a query with the Query_1 identifier. The query has one parameter.
Add links to the Metabase, Db system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
DSInst: IDatasetInstance;
DSModel: IDatasetModel;
Params: IMetabaseObjectParamValues;
Fields: IDatasetInstanceFields;
Field: IDatasetInstanceField;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("Query_1").Bind;
DSModel := MObj As IDatasetModel;
Params := MObj.Params.CreateEmptyValues;
Params.Item(0).Value := "100";
DSInst := DSModel.Open(Params);
Fields := DSInst.Fields;
While Not DSInst.Eof Do
For Each Field In Fields Do
Debug.Write(Field.Value + " ");
End For;
Debug.WriteLine("");
DSInst.Next;
End While;
End Sub UserProc;
After executing the example, query with specified value of the parameter is opened. The data received as query execution result is displayed in the development environment console.
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;
DSInst: IDatasetInstance;
DSModel: IDatasetModel;
Param: IMetabaseObjectParamValues;
Fields: IDatasetInstanceFields;
Field: IDatasetInstanceField;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["Query_1"].Bind();
DSModel := MObj As IDatasetModel;
Param := MObj.Params.CreateEmptyValues();
Param.Item[0].Value := "100";
DSInst := DSModel.Open(Param);
Fields := DSInst.Fields;
While Not DSInst.Eof() Do
For Each Field In Fields Do
System.Diagnostics.Debug.Write(Field.Value + " ");
End For;
System.Diagnostics.Debug.WriteLine("");
DSInst.Next();
End While;
End Sub;
See also: