IDtRecordsetConsumer.Put

Syntax

Put(Value: Array);

Parameters

Value is a data array that has to be exported.

Description

The Put method exports data according to custom algorithm. The interface must be redefined in the custom class.

Example

Class MyConsumer: Object, IDtRecordsetConsumer

Public Sub Put(Value: Array);

Var

TextFile: IFileInfo;

TextW: ITextWriter;

i, j: Integer;

Begin

TextFile := New FileInfo.Attach("c:\Out.txt");

If TextFile.Exists Then

TextW := TextFile.AppendText;

Else

TextFile.Open(FileOpenMode.Create, FileShare.Exclusive);

TextW := TextFile.AppendText;

End If;

For j := Value.GetLowerBound(2) To Value.GetUpperBound(2) Do

For i := Value.GetLowerBound(1) To Value.GetUpperBound(1) Do

If i = 0 Then

TextW.WriteString(Value[i, j] + " ");

Else

TextW.WriteLnDouble(Value[i, j]);

End If;

End For;

End For;

End Sub Put;

 

Public Sub Clear;

Var

TextFile: IFileInfo;

Begin

TextFile := New FileInfo.Attach("c:\Out.txt");

TextFile.Open(FileOpenMode.Create, FileShare.DenyWrite);

End Sub Clear;

End Class MyConsumer;

The example is a macro, containing implementation of the method, that exports data by custom algorithm. For algorithm work arrival as an array parameter, containing two data columns, is required. The first column contains symbolic data, the second- real numbers. During export data is output into the c:\Out.txt text file.

See also:

IDtRecordsetConsumer