DelimitedColumnDelimiter: String;
The DelimitedColumnDelimiter property determines the symbol used as a field delimiter in the text file.
By default the property is set to ",quot;.
The following values are acceptable as a value of this property:
,
;
.
:
|
{Tabulation} - code #9
{Carriage return} - code #13
{Line feed} - code #10
{Carriage return}{Line feed} - #13+#10
Any other symbol, or a combination of symbols, optional for user.
Executing the example requires that the repository contains an ETL task with the ETL identifier.
Sub UserProc;
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 creating a data consumer
// 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.FormatType := DtTextFormatType.Delimited;
TextConsumer.WriteHeader := True;
TextConsumer.RowDelimiter := #13 + #10; //Return carriage + transfer row
TextConsumer.DelimitedColumnDelimiter := #9; //TAB key
TextConsumer.DelimitedTextQualifier := "'";
EtlConsumer.FillDefault;
// Save data consumer
EtlConsumer.Save;
// End of creating a data consumer
// 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 UserProc;
After executing the example the Export to text object is created in the ETL task. During export the Carriage Return+Line Feed 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: