IDtUserConsumerEx.Module

Syntax

Module: IMetabaseObjectDescriptor;

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

Description

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

Comments

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

Example

Executing the example requires a module with the CUSTOM_EXPORT identifier (of the .NET assembly with the CUSTOM_EXPORT_NET identifier) containing the MyDtCustomConsumer class.

Add links to the Dal, Dt, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Consumer: IDtUserConsumerEx;
    Fields: IDtFieldDefinitions;
    Field: IDtFieldDefinition;
    v: Array;
    CustomCons: IDtCustomConsumer;
Begin
    MB := MetabaseClass.Active;
    
//Array of exported values
    v := New Variant[34];
    v[
00] := "Buckwheat"; v[10] := 10; v[20] := 313.12;
    v[
01] := "Milk"; v[11] := 20; v[21] := 301.53;
    v[
02] := "Sugar"; v[12] := 30; v[22] := 254.13;
    v[
03] := "Bread"; v[13] := 40; v[23] := 404.11;
    Consumer := 
New DtUserConsumerEx.Create;
    Consumer.Metabase := MB;
    Consumer.Module := MB.ItemById(
"CUSTOM_EXPORT");
    Consumer.Macro := 
"MyDtCustomConsumer";
    Fields := Consumer.Fields;
    Field := Fields.Add;
    Field.DataType := DbDataType.String;
    Field.Name := 
"Name";
    Field := Fields.Add;
    Field.DataType := DbDataType.Integer;
    Field.Name := 
"Identifier";
    Field := Fields.Add;
    Field.DataType := DbDataType.Float;
    Field.Name := 
"Value";
    Consumer.Open;
    Consumer.Clear;
    CustomCons := Consumer.CustomConsumer;
    
If CustomCons.ImplementPut Then
        Consumer.Put(v);
        Debug.WriteLine(
"Number of recorded strings: " + Consumer.WritingRowsCount.ToString);
    
Else
        Debug.WriteLine(
"Unload of two-dimensional arrays is not available");
    
End If;
    Consumer.Close;
End Sub UserProc;

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

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Consumer: IDtUserConsumerEx;
    Fields: IDtFieldDefinitions;
    Field: IDtFieldDefinition;
    v: Array;
    customCons: IDtCustomConsumer;
Begin
    MB := Params.Metabase;
    
//Array of exported values
    v := New object[43];
    v[
00] := "Buckwheat"; v[01] := 10; v[02] := 313.12;
    v[
10] := "Milk"; v[11] := 20; v[12] := 301.53;
    v[
20] := "Sugar"; v[21] := 30; v[22] := 254.13;
    v[
30] := "Bread"; v[31] := 40; v[32] := 404.11;
    Consumer := 
New DtUserConsumerEx.Create();
    Consumer.Metabase := MB;
    Consumer.Module := MB.ItemById[
"CUSTOM_EXPORT_NET"];
    Consumer.Macro := 
"MyDtCustomConsumer";
    Fields := Consumer.Fields;
    Field := Fields.Add();
    Field.DataType := DbDataType.ddtString;
    Field.Name := 
"Name";
    Field := Fields.Add();
    Field.DataType := DbDataType.ddtInteger;
    Field.Name := 
"Identifier";
    Field := Fields.Add();
    Field.DataType := DbDataType.ddtFloat;
    Field.Name := 
"Value";
    Consumer.Open();
    Consumer.Clear();
    customCons := Consumer.CustomConsumer;
    
If customCons.ImplementPut() Then
        Consumer.Put(v);
        System.Diagnostics.Debug.WriteLine(
"Number of recorded strings: " + Consumer.WritingRowsCount().ToString());
    
Else
        System.Diagnostics.Debug.WriteLine(
"Unload of two-dimensional arrays is unavailable");
    
End If;
    Consumer.Close();
End Sub;

On executing the example data is unloaded to the consumer using custom algorithm.

See also:

IDtUserConsumerEx