IEtlTask.Create

Syntax

Create(Type: EtlObjectType): IEtlObject;

Parameters

Type. Type of ETL task object.

Description

The Create method creates an ETL task object. Object type is passed by the Type parameter.

Example

To execute the example, add links to the system assemblies:

Executing the example requires that the repository contains a folder with the ETLTASKS identifier and the data.xls file on the local drive, from which data is imported. Create a new ETL task in the folder with the specified identifier. Add the task to the Import from Excel object.

Sub  UserProc;
Var
    MB: IMetabase;
    ci: IMetabaseObjectCreateInfo;
    MbObj: IMetabaseObject;
    EtlTask: IEtlTask;
    EtlProvider: IEtlPlainDataProvider;
    ExcelProvider: IDtExcelProvider;
    WxConsumer: IWxRectangle;
    WxETLConsumer: IWxEtlObject;
Begin 
    MB := MetabaseClass.Active;
    //Create a new ETL task
    ci := Mb.CreateCreateInfo;
    ci.ClassId := MetabaseObjectClass.KE_CLASS_ETLTASK;
    ci.Parent := MB.ItemById("ETLTASKS");
    ci.Name := "ETL task";
    ci.Id := "ETLTASK";
    MbObj := Mb.CreateObject(ci).Edit;
    EtlTask := MbObj 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";
    EtlProvider.Description := "Data from the data.xls file";
    //Set up data source
    ExcelProvider := EtlProvider.Provider As IDtExcelProvider;
    ExcelProvider.File := "c:\data.xls";
    ExcelProvider.DriverVersion := "Excel 8.0";
    ExcelProvider.Query := "select * from [Sheet1$]";
    ExcelProvider.HasHeader := False;
    EtlProvider.FillDefault;
    //Save Excel source
    EtlProvider.Save;
    //Create a visual object
    WxConsumer := EtlTask.Workspace.CreateRectangle;
    WxETLConsumer := New WxEtlObject.Create;
    WxETLConsumer.EtlObject := EtlProvider;
    WxConsumer.Style.TextPosition := WxTextPosition.Bottom;
    WxConsumer.Style.PictureMarginTop := -10
    WxConsumer.PinPosition := New GxPointF.Create(5050);
    WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;
    //Save repository object
    MbObj.Save;
End Sub UserProc;

After executing the example an ETL task named EYL Task is created in the folder with the ETLTASKS identifier. The Import from Excel object with the FILE_XLS identifier is added to this ETL task, data is taken from the c:\data.xls file.

See also:

IEtlTask