DelimitedColumnDelimiter: String;
The DelimitedColumnDelimiter property determines the symbol, used as a field delimiter in the text file.By default the property is set to ",".
The following values are acceptable as a value of this property:
,
;
.
:
|
{Tabulation} - code #9
{Carriage return} - code #13
{Row transfer} - code #10
{Carriage return}{Row transfer} - #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, and the text file Data.txt in the disk C root directory.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
TextProvider: IDtTextProvider;
WxProvider: IWxRectangle;
WxETLProvider: 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 the provider creation
//The Import From Text object creation
EtlProvider := EtlTask.Create(EtlObjectType.PlainDataTextProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit;
EtlProvider.Id := "Text_Provider";
EtlProvider.Name := "Import from text";
EtlProvider.Description := "Import from text";
//Set up data provider
TextProvider := EtlProvider.Provider As IDtTextProvider;
TextProvider.File := "c:\Data.txt";
TextProvider.RangeHasHeader := True;
TextProvider.RowDelimiter := #13 + #10; //Carriage return + row transfer
TextProvider.DelimitedColumnDelimiter := #9; //Tab button
TextProvider.FieldsFromFile;
EtlProvider.FillDefault;
//Save provider
EtlProvider.Save;
//End of provider creation
//Start of visual object creation
WxProvider := EtlTask.Workspace.CreateRectangle;
WxETLProvider := New WxETLObject.Create;
WxETLProvider.ETLObject := EtlProvider;
WxProvider.Style.TextPosition := WxTextPosition.Bottom;
WxProvider.Style.PictureMarginTop := -10;
WxProvider.PinPosition := New GxPointF.Create(50, 50);
WxProvider.Extension := WxETLProvider As IWxShapeExtension;
//End of visual object creation
//Save Etl task
MObj.Save;
End Sub Main;
After executing the example the Import from text object is created in the ETL task. The provider imports data from the Data.txt text file. During import the Carriage return+Row transfer combination is used as a row delimiter, and Tabulation symbol - as a field delimiter. Field names are imported from the first file row.
See also: