Put(Value: Array);
Value. Data array that should be exported.
The Put method exports data according to user algorithm.
The interface must be redefined in the custom class.
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;
TextW.Encoding := CodePage.UTF8;
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;
TextW.Flush;
End Sub Put;
Public Sub Clear;
Var
TextFile: IFileInfo;
Begin
TextFile := New FileInfo.Attach("c:\Out.txt");
TextFile.Open(FileOpenMode.Create, FileShare.DenyWrite);
Dispose TextFile;
End Sub Clear;
End Class MyConsumer;
The example is a macro containing implementation of the method that exports data by means of user algorithm. For algorithm work arrival as an array parameter, containing two data columns, is required. The first column contains symbolic data, the second contains real numbers. During export data is output into the c:\Out.txt file.
See also: