File: String;
The File property determines the path and the name of the file, in which the data is exported.
Executing the example requires that the repository contains an ETL task with the ETL identifier.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlConsumer: IEtlPlainDataConsumer;
ExcelConsumer: IDtExcelConsumer;
WxConsumer: IWxRectangle;
WxETLConsumer: 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 "Export to Excel" object
EtlConsumer := EtlTask.Create(EtlObjectType.PlainDataExcelConsumer) As IEtlPlainDataConsumer;
EtlConsumer := EtlConsumer.Edit;
EtlConsumer.Id := "Excel_Consumer";
EtlConsumer.Name := "Export to Excel";
EtlConsumer.Description := "Export to Excel";
// Set up data provider
ExcelConsumer := EtlConsumer.Consumer As IDtExcelConsumer;
ExcelConsumer.File := "c:\DataOut.xls";
ExcelConsumer.Table := "Output data";
ExcelConsumer.DriverVersion := "Excel 8.0";
// Save data provider
EtlConsumer.Save;
// End of data provider creation
// Start of visual object creation
WxConsumer := EtlTask.Workspace.CreateRectangle;
WxETLConsumer := New WxETLObject.Create;
WxETLConsumer.ETLObject := EtlConsumer;
WxConsumer.Style.TextPosition := WxTextPosition.Bottom;
WxConsumer.Style.PictureMarginTop := -10;
WxConsumer.PinPosition := New GxPointF.Create(50, 50);
WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;
// End of visual object creation
// Save ETL task
MObj.Save;
End Sub UserProc;
After executing the example the Export to Excel object is created in the ETL task. This data consumer exports data to the DataOut.xls file. If such file does not exist, it is created. The name of the sheet, to which export is executed is OutputData. The Excel 8.0 drivers are used for connection.
See also: