IDtTextProvider.RangeFirstRow

Syntax

RangeFirstRow: Integer;

Description

The RangeFirstRow property determines the number of the row starting from which the data is imported.

Example

Executing the example requires that the repository contains an ETL task with the ETL identifier and the Data.txt file in the root of the C disk.

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 data provider creation
    // 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 provider
    TextProvider := EtlProvider.Provider As IDtTextProvider;
    TextProvider.File := "c:\Data.txt";
    TextProvider.RangeHasHeader := True;
    TextProvider.RowDelimiter := #13 + #10; //Carriage return + Line feed
    TextProvider.DelimitedColumnDelimiter := #9; //TAB key
    TextProvider.RangeFirstRow := 5;
    TextProvider.FieldsFromFile;
    EtlProvider.FillDefault;
    // Save data provider
    EtlProvider.Save;
    // End of data 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(5050);
    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. This data provider imports data from the specified text file. During import the Carriage Return+Line Feed combination is used as a row delimiter, and Tabulation symbol - as a field delimiter. Field names are imported from the first file row. Data is imported starting from the fifth file row.

See also:

IDtTextProvider