Module: IMetabaseObjectDescriptor;
The Module property determines a Fore unit or assembly of the 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 unit with the CUSTOM_EXPORT 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;
On executing the example data is unloaded to the consumer using custom algorithm.
See also: