TextCodePage: CodePage;
TextCodePage: Prognoz.Platform.Interop.ForeSystem.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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Etl;
Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Drawing;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
EtlTask: IEtlTask;
EtlConsumer: IEtlPlainDataConsumer;
TextConsumer: IDtTextConsumer;
WxConsumer: IWxRectangle;
WxETLConsumer: IWxETLObject;
PinPosition: GxPointF = New GxPointFClass();
Begin
MB := Params.Metabase;
EtlTask := MB.ItemById["ETL"].Edit() As IEtlTask;
//Create the Export to Text object
EtlConsumer := EtlTask.Create(EtlObjectType.eotPlainDataTextConsumer) 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.cpUTF7;
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.wtpBottom;
WxConsumer.Style.PictureMarginTop := -10;
PinPosition := WxConsumer.PinPosition;
PinPosition.Create(50, 50);
WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;
//Save Etl task
(EtlTask As IMetabaseObject).Save();
End Sub;
See also: