IDtRecordsetConsumer.Clear

Syntax

Clear;

Description

The Clear method clears data consumer 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. To provide algorithm work, it is expected to get parameter containing two data columns as an array. The first column contains symbolic data, the second- real numbers. During export data is output into the c:\Out.txt text file. Clear method rewrites this file.

See also:

IDtRecordsetConsumer