CustomConsumer: IDtCustomConsumer;
CustomConsumer: Prognoz.Platform.Interop.Dt.IDtCustomConsumer;
The CustomConsumer property returns data consumer obtained using custom algorithm.
Data consumer is available after the IDtObject.Open method activation only.
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[3, 4];
v[0, 0] := "Buckwheat"; v[1, 0] := 10; v[2, 0] := 313.12;
v[0, 1] := "Milk"; v[1, 1] := 20; v[2, 1] := 301.53;
v[0, 2] := "Sugar"; v[1, 2] := 30; v[2, 2] := 254.13;
v[0, 3] := "Bread"; v[1, 3] := 40; v[2, 3] := 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.
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[4, 3];
v[0, 0] := "Rice"; v[0, 1] := 10; v[0, 2] := 313.12;
v[1, 0] := "Milk"; v[1, 1] := 20; v[1, 2] := 301.53;
v[2, 0] := "Sugar"; v[2, 1] := 30; v[2, 2] := 254.13;
v[3, 0] := "Bread"; v[3, 1] := 40; v[3, 2] := 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: