IDtUserProviderEx.CustomProvider

Fore syntax

CustomProvider: IDtCustomProvider;

Fore.NET syntax

CustomProvider: Prognoz.Platform.Interop.Dt.IDtCustomProvider;

Description

The CustomProvider property returns the data provider, obtained with help of custom algorithm.

Comments

Data provider is available after the IDtObject.Open method activation only.

Fore example

Executing the example requires a module with the CUSTOM_LOAD identifier containing the MyDtCustomProvider class. Add links to the Metabase, Dt system assemblies.

Sub UserProc_CustomProvider;
Var
    UsProv: IDtUserProviderEx;
    CustProv: IDtCustomProvider;
    Values: Array;
    ReadingRows: Integer;
Begin
    UsProv := New DtUserProviderEx.Create;
    UsProv.Metabase := MetabaseClass.Active;
    UsProv.ImplClass := "CUSTOM_LOAD.MyDtCustomProvider";
    UsProv.Open;
    UsProv.FieldsFromFile;
    CustProv := UsProv.CustomProvider;
    If CustProv.ImplementFetchRows Then
        CustProv.FetchRows(10, Values);
    Else
        While Not CustProv.Eof Do
            CustProv.Fetch(Values);
        End While;
    End If;
    ReadingRows := CustProv.ReadingRowsCount;
    Debug.WriteLine("Read " + ReadingRows.ToString + " rows");
    UsProv.Close;
End Sub UserProc_CustomProvider;

Result: there will be an attempt to load strings from data consumer, that was obtained using a custom algorithm, in the Values array with the help of the custom algorithm. In the console window the number of actual loaded strings will be shown.

Fore.NET Example

Executing the example requires a .NET assembly with the CUSTOM_LOAD_NET identifier, containing the MyDtCustomProvider class.

Imports Prognoz.Platform.Interop.Dt;

Public Shared Sub Main(Params: StartParams);
Var
    UsProv: IDtUserProviderEx;
    CustProv: IDtCustomProvider;
    Values: Array;
    ReadingRows: Integer;
Begin
    UsProv := New DtUserProviderEx.Create();
    UsProv.Metabase := Params.Metabase;
    UsProv.ImplClass := "CUSTOM_LOAD_NET.MyDtCustomProvider";
    UsProv.Open();
    UsProv.FieldsFromFile();
    CustProv := UsProv.CustomProvider;
    If CustProv.ImplementFetchRows() Then
        CustProv.FetchRows(10Var Values);
    Else
        While Not CustProv.Eof Do
            CustProv.Fetch(Var Values);
        End While;
    End If;
    ReadingRows := CustProv.ReadingRowsCount();
    System.Diagnostics.Debug.WriteLine("Read " + ReadingRows.ToString() + " rows");
    UsProv.Close();
End Sub;

Result: there will be an attempt to load strings from data consumer, that was obtained using a custom algorithm, in the Values array with the help of the custom algorithm. In the console window the number of actual loaded strings will be shown.

See also:

IDtUserProviderEx