IEtlPlainDataProvider.FillFromSource

Syntax

FillFromSource;

Description

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

Example

Executing this example requires ETL tasks with the ETL identifier and a file c:\TestDocument.xls, that represents data source, to exist in repository.

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;

//Creation of an object Import from Excel

EtlProvider := EtlTask.Create(EtlObjectType.PlainDataExcelProvider) As IEtlPlainDataProvider;

EtlProvider:= EtlProvider.Edit;

EtlProvider.Id:= "File_XLS";

EtlProvider.Name:= "Data source XLS";

//Configuration of data source

ExcelProvider := EtlProvider.Provider As IDtExcelProvider;

ExcelProvider.File := "c:\TestDocument.xls";

ExcelProvider.DriverVersion := "Excel 8.0";

ExcelProvider.Query := "select * from [Sheet1$]";

EtlProvider.FillFromSource;

EtlProvider.Save;

//Creation of 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(20, 20);

WxDataTrans.Extension := WxETLDataTrans As IWxShapeExtension;

End Sub CreateWX;

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

See also:

IEtlPlainDataProvider