IDtUserConsumerEx.CustomConsumer

Fore Syntax

CustomConsumer: IDtCustomConsumer;

Fore.NET Syntax

CustomConsumer: Prognoz.Platform.Interop.Dt.IDtCustomConsumer;

Description

The CustomConsumer property returns data consumer obtained using custom algorithm.

Comments

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

Fore example

Executing the example requires a module with the CUSTOM_EXPORT identifier, containing the MyDtCustomConsumer class. Add links to the Metabase, Dt, Dal system assemblies.

Sub UserProc_ImplClass;
Var
    Consumer: IDtUserConsumerEx;
    Fields: IDtFieldDefinitions;
    Field: IDtFieldDefinition;
    v: Array;
    customCons: IDtCustomConsumer;
Begin
//Array of exporting 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 := MetabaseClass.Active;
    Consumer.ImplClass := "CUSTOM_EXPORT.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_ImplClass;

After executing the example data will be loaded in the consumer using a custom algorithm.

Fore.NET Example

Executing the example requires a .NET assembly with the CUSTOM_EXPOR_NET identifier, containing the MyDtCustomConsumer class.

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

Public Shared Sub Main(Params: StartParams);
Var
    Consumer: IDtUserConsumerEx;
    Fields: IDtFieldDefinitions;
    Field: IDtFieldDefinition;
    v: Array;
    customCons: IDtCustomConsumer;
Begin
//Array of exporting values
    v := New object[43];
    v[00] := "Rice"; 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 := Params.Metabase;
    Consumer.ImplClass := "CUSTOM_EXPORT_NET.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 not available");
    End If;
    Consumer.Close();
End Sub;

After executing the example data will be loaded in the consumer using a custom algorithm.

See also:

IDtUserConsumerEx