IDatasetModel.OpenWhere

Syntax

OpenWhere(Params: IMetabaseObjectParamValues; Where: String): IDatasetInstance;

Parameters

Params. Parameter values for opening data source. Null if parameters are absent.

Where. The condition of filtering used at opening.

Description

The OpenWhere method opens a data source using the filter, which condition is passed by the Where parameter.

Example

Executing the example requires that the repository contains a query with the Query_1 identifier. The query has one parameter.

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.OpenWhere(Params, "Num2>15");
    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;
    DSInst.Close;
End Sub UserProc;

After executing the example, query with specified value of the parameter is opened. The data received as a result of query execution and filtered with the condition Num2>15 are displayed in the development environment console.

See also:

IDatasetModel