IDtUserProviderEx.Module

Syntax

Module: IMetabaseObjectDescriptor;

Module: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;

Description

The Module property determines the Fore/Fore.NET module or assembly of the repository where custom algorithm of data receiving is implemented.

Comments

The Module property is used in combination with the Macro property.

Example

Executing the example requires a module with the CUSTOM_IMPORT identifier (of the .NET assembly with the CUSTOM_IMPORT_NET identifier) containing the MyDtCustomProvider class.

Add links to the Dt, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    UserProvider: IDtUserProviderEx;
    CustomProvider: IDtCustomProvider;
    Values: Array;
    ReadingRows: Integer;
Begin
    MB := MetabaseClass.Active;
    UserProvider := 
New DtUserProviderEx.Create;
    UserProvider.Metabase := MB;
    UserProvider.Module := MB.ItemById(
"CUSTOM_IMPORT");
    UserProvider.Macro := 
"MyDtCustomProvider";
    UserProvider.Open;
    UserProvider.FieldsFromFile;
    CustomProvider := UserProvider.CustomProvider;
    
If CustomProvider.ImplementFetchRows Then
        CustomProvider.FetchRows(
10, Values);
    
Else
        
While Not CustomProvider.Eof Do
            CustomProvider.Fetch(Values);
        
End While;
    
End If;
    ReadingRows := CustomProvider.ReadingRowsCount;
    Debug.WriteLine(
"The " + ReadingRows.ToString + " strings are read.");
    UserProvider.Close;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    UserProvider: IDtUserProviderEx;
    CustomProvider: IDtCustomProvider;
    Values: Array;
    ReadingRows: Integer;
Begin
    MB := Params.Metabase;
    UserProvider := 
New DtUserProviderEx.Create();
    UserProvider.Metabase := MB;
    UserProvider.Module := MB.ItemById[
"CUSTOM_IMPORT_NET"];
    UserProvider.Macro := 
"MyDtCustomProvider";
    UserProvider.Open();
    UserProvider.FieldsFromFile();
    CustomProvider := UserProvider.CustomProvider;
    
If CustomProvider.ImplementFetchRows() Then
        CustomProvider.FetchRows(
10Var Values);
    
Else
        
While Not CustomProvider.Eof Do
            CustomProvider.Fetch(
Var Values);
        
End While;
    
End If;
    ReadingRows := CustomProvider.ReadingRowsCount();
    System.Diagnostics.Debug.WriteLine(
"The " + ReadingRows.ToString() + " strings are read.");
    UserProvider.Close();
End Sub;

On executing the example, custom algorithm loads strings from data source to the Values array. In the console window the number of actual loaded strings will be shown.

See also:

IDtUserProviderEx