TextCodePage: CodePage;
The TextCodePage property determines the encoding used on data export to file.
To determine the file, to which data is exported, use the IDtTextConsumer.File property.
Executing the example requires that repository contains an ETL task with the ETL identifier and the C:\Data.txt text file.
Add links to the Metabase, Etl, Dt, Andy, Drawing system assemblies.
Sub UserProc;
Var
MB: IMetabase;
EtlTask: IEtlTask;
EtlConsumer: IEtlPlainDataConsumer;
TextConsumer: IDtTextConsumer;
WxConsumer: IWxRectangle;
WxETLConsumer: IWxETLObject;
Begin
MB := MetabaseClass.Active;
EtlTask := MB.ItemById("ETL").Edit As IEtlTask;
//Create the Export to Text object
EtlConsumer := EtlTask.Create(EtlObjectType.PlainDataTextConsumer) As IEtlPlainDataConsumer;
EtlConsumer := EtlConsumer.Edit;
EtlConsumer.Id := "Text_Consumer";
EtlConsumer.Name := "Export in text";
EtlConsumer.Description := "Export in text";
//Set up data consumer
TextConsumer := EtlConsumer.Consumer As IDtTextConsumer;
TextConsumer.File := "C:\Data_out.txt";
TextConsumer.WriteHeader := True;
TextConsumer.RowDelimiter := "|";
TextConsumer.DelimitedColumnDelimiter := ";";
TextConsumer.DelimitedTextQualifier := "'";
TextConsumer.TextCodePage := CodePage.UTF7;
EtlConsumer.FillDefault;
//Save consumer
EtlConsumer.Save;
//Create a visual object
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;
//Save Etl task
(EtlTask As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the Export to text object is created in the ETL task. The object will export data to the C:\Data.txt text file with specified settings:
The | character is used as a string separator.
The ; character is used as a field separator.
The ' character is used as a text delimiter.
Used encoding UTF7 - Unicode UTF-7.
See also: