IDatasetModel.Open

Syntax

Open(Params: IMetabaseObjectParamValues): IDatasetInstance;

Parameters

Params. Data source parameters. Null if parameters are absent.

Description

The Open method opens a data source. Values of data source parameters are passed by Params.

Comments

To open and close a data source using filter, use the IDatasetModel.OpenWhere method.

Example

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.

See also:

IDatasetModel