IDtTextProvider.TextCodePage

Syntax

TextCodePage: CodePage;

Description

The TextCodePage property determines the encoding used on data import from file.

Comments

To determine the file, from which data is imported, use the IDtTextProvider.File property.

Example

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;
    EtlProvider: IEtlPlainDataProvider;
    TextProvider: IDtTextProvider;
    DateFormat: IDtObjectDataFormat;
    WxProvider: IWxRectangle;
    WxETLProvider: IWxETLObject;
Begin
    MB := MetabaseClass.Active;
    EtlTask := MB.ItemById("ETL").Edit As IEtlTask;
    //Create the Import from Text object
    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 source
    TextProvider := EtlProvider.Provider As IDtTextProvider;
    TextProvider.File := "C:\Data.txt";
    TextProvider.RangeHasHeader := True;
    TextProvider.RowDelimiter := "|";
    TextProvider.DelimitedColumnDelimiter := ";";
    TextProvider.FieldsFromFile;
    TextProvider.TextCodePage := CodePage.UTF7;
    DateFormat := TextProvider.StringDataFormat;
    DateFormat.DateFormat := "DD/MM/YYYY";
    DateFormat.DecimalDelimiter := ".";
    EtlProvider.FillDefault;
    //Save source
    EtlProvider.Save;
    //Create a visual object 
    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(5050);
    WxProvider.Extension := WxETLProvider As IWxShapeExtension;
    //Save Etl task
    (EtlTask As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the Import from text object is created in the ETL task. The object imports data from the C:\Data.txt text file with specified settings:

See also:

IDtTextProvider