Query: String;
The Query property determines tables query stored in Access database. Imported data is selected by means of the query.
Executing the example requires that the repository contains an ETL task with the Etl identifier and an Access database file named db.mdb in the disk C root directory. There is a table named Table_1 in the database.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
AccessProvider: IDtAccessProvider;
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 the provider creation
//The Import From Access object creation
EtlProvider := EtlTask.Create(EtlObjectType.PlainDataAccessProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit;
EtlProvider.Id := "Access_Provider";
EtlProvider.Name := "Import from Access";
EtlProvider.Description := "Import from Access";
//Data provider setting
AccessProvider := EtlProvider.Provider As IDtAccessProvider;
AccessProvider.File := "c:\db.mdb";
AccessProvider.Query := "Select * from Table_1";
EtlProvider.FillDefault;
//Saving the provider
EtlProvider.Save;
//End of provider creation
//Start of visual object creation
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(50, 50);
WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;
//End of visual object creation
//Save Etl task
MObj.Save;
End Sub Main;
After executing the example the Import from Access object is created in the ETL task . The provider extracts data from the table Table_1, that is stored in Access db.mdb database.
See also: