FillFromSource;
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.
Executing the example requires that the repository contains an ETL task with the ETL identifier and the file c:\TestDocument.xls that represents data source.
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 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: