Module: IMetabaseObjectDescriptor;
The Module property determines Fore/Fore.NET module/assembly of repository where the custom algorithm of data loading is implemented.
The Module property is used in combination with the Macro property.
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[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 := 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[4, 3];
v[0, 0] := "Buckwheat"; 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 := 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: