IDtFieldDefinition.DataType

Syntax

DataType: DbDataType;

Description

The DataType property determines data type of the data provider/data consumer field.

Example

Executing the example requires the Data_Out.txt file in the disk C root directory.

Sub Main;

Var

TextConsumer: IDtTextConsumer;

Fields: IDtFieldDefinitions;

Field: IDtFieldDefinition;

v: Array;

Begin

//Array of exported values

TextConsumer := New DtTextConsumer.Create;

TextConsumer.File := "c:\Data_Out.txt";

TextConsumer.WriteHeader := True;

TextConsumer.RowDelimiter := #13 + #10; //Carriage return + row transfer

TextConsumer.DelimitedColumnDelimiter := #9; //Button Tab

Fields := TextConsumer.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";

TextConsumer.Open;

TextConsumer.Clear;

TextConsumer.Put(v);

TextConsumer.Close

End Sub Main;

After executing the example a new data consumer, that exports data in text file, is created. During export the Carriage return+Row transfer combination is used as a row delimiter, and Tabulation symbol - as a field delimiter. Into the first file row field names are written. Next the specified values array is exported into the file.

See also:

IDtFieldDefinition