IDtTextConsumer.File

Syntax

File: String;

Description

The File property determines the path and the name of the text file, in which the data is exported.

Example

Executing the example requires that the repository contains an ETL task with the Etl identifier.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

EtlTask: IEtlTask;

EtlConsumer: IEtlPlainDataConsumer;

TextConsumer: IDtTextConsumer;

WxConsumer: IWxRectangle;

WxETLConsumer: IWxETLObject;

Begin

MB := MetabaseClass.Active;

//ETL task search. Repository object with the ETL identifier

MObj := MB.ItemById("Etl").Edit;

EtlTask := MObj As IEtlTask;

//Start of consumer creation

//The Export To Text object creation

EtlConsumer := EtlTask.Create(EtlObjectType.PlainDataTextConsumer) As IEtlPlainDataConsumer;

EtlConsumer := EtlConsumer.Edit;

EtlConsumer.Id := "Text_Consumer";

EtlConsumer.Name := "Export to text";

EtlConsumer.Description := "Export to text";

//Set up data consumer

TextConsumer := EtlConsumer.Consumer As IDtTextConsumer;

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

TextConsumer.WriteHeader := True;

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

TextConsumer.DelimitedColumnDelimiter := #9; //The TAB key

TextConsumer.DelimitedTextQualifier := "'";

//Save consumer

EtlConsumer.Save;

//End of consumer creation

//Start of visual object creation

WxConsumer := EtlTask.Workspace.CreateRectangle;

WxETLConsumer := New WxETLObject.Create;

WxETLConsumer.ETLObject := EtlConsumer;

WxConsumer.Style.TextPosition := WxTextPosition.Bottom;

WxConsumer.Style.PictureMarginTop := -10;

WxConsumer.PinPosition := New GxPointF.Create(50, 50);

WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;

//End of visual object creation

//Save Etl task

MObj.Save;

End Sub Main;

After executing the example the Export to text object is created in the ETL task. During export the Carriage return+Row transfer combination is used as a row delimiter, and Tabulation symbol - as a field delimiter. Apostrophe is a text delimiter. Field names are exported in the first file row. If the file does not exist it is created.

See also:

IDtTextConsumer