IEtlPlainDataProvider.FillFromSource

Syntax

FillFromSource;

Description

The FillFromSource method fills output fields based on a source file structure. On the method call fields of a data source are cleared, then they are filled based on a source file structure.

Example

Executing the example requires that the repository contains an ETL task with the ETL identifier and the file C:\TestDocument.xls that represents is a data provider.

Sub UserProc;
Var
    Metabase : IMetabase;
    MObj: IMetabaseObject;
    EtlTask: IEtlTask;
    EtlProvider: IEtlPlainDataProvider;
    ExcelProvider: IDtExcelProvider;
Begin
    Metabase := MetabaseClass.Active;
    MObj := Metabase.ItemById("ETL").Edit;
    EtlTask := MObj As IEtlTask;
    // Create the "Import from Excel" object
    EtlProvider := EtlTask.Create(EtlObjectType.PlainDataExcelProvider) As IEtlPlainDataProvider;
    EtlProvider:= EtlProvider.Edit;
    EtlProvider.Id:= "File_XLS";
    EtlProvider.Name:= "XLS data provider";
    // Set up data provider
    ExcelProvider := EtlProvider.Provider As IDtExcelProvider;
    ExcelProvider.File := "c:\TestDocument.xls";
    ExcelProvider.DriverVersion := "Excel 8.0";
    ExcelProvider.Query := "select * from [Sheet1$]";
    EtlProvider.FillFromSource;
    EtlProvider.Save;
    // Create a visual object
    CreateWX(EtlProvider, EtlTask);
    MObj.Save;
End Sub UserProc;

Sub CreateWX(CopyObj: IEtlPlainDataProvider; etltask: IEtltask);
Var
    WxDataTrans: IWxRectangle;
    WxETLDataTrans: IWxEtlObject;
Begin
    WxDataTrans := EtlTask.Workspace.CreateRectangle;
    WxDataTrans.Id := CopyObj.Id;
    WxETLDataTrans := New WxEtlObject.Create;
    WxETLDataTrans.EtlObject := CopyObj;
    WxDataTrans.Style.TextPosition := WxTextPosition.Bottom;
    WxDataTrans.Style.PictureMarginTop := -10;
    WxDataTrans.PinPosition := New GxPointF.Create(2020);
    WxDataTrans.Extension := WxETLDataTrans As IWxShapeExtension;
End Sub CreateWX;

After executing the example (UserProc) data source XLS is created for ETL task. Output fields of XLS data source correspond to available fields in the TestDocument.xls file on the first sheet.

See also:

IEtlPlainDataProvider