ForeModule: IModule;
The ForeModule property determines the module, which contains the class, that implements custom provider.
Executing the example requires that the repository contains an ETL task with the Etl identifier, and the ModuleProvider module, containing the MyProvider class, that implements custom provider. Custom source work results in the array, that contains symbolic and real values.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
UserProvider: IDtUserProvider;
WxProvider: IWxRectangle;
WxETLProvider: IWxETLObject;
Fields: IDtFieldDefinitions;
Field: IDtFieldDefinition;
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 source creation
//The Custom Provider creation object
EtlProvider := EtlTask.Create(EtlObjectType.PlainDataUserProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit;
EtlProvider.Id := "User_Provider";
EtlProvider.Name := "Custom provider";
EtlProvider.Description := "Custom provider";
//Data source setting
UserProvider := EtlProvider.Provider As IDtUserProvider;
UserProvider.ForeModule := MB.ItemById("ModuleProvider").Bind As IModule;
UserProvider.ForeClass := "MyProvider";
Fields := UserProvider.Fields;
Field := Fields.Add;
Field.DataType := DbDataType.String;
Field.Name := "Name";
Field := Fields.Add;
Field.DataType := DbDataType.Float;
Field.Name := "Value";
EtlProvider.FillDefault;
//Saving the source
EtlProvider.Save;
//End of source creation
//Start of visual object creation
WxProvider := EtlTask.Workspace.CreateRectangle;
WxETLProvider := New WxETLObject.Create;
WxETLProvider.ETLObject := EtlProvider;
WxProvider.Style.TextPosition := WxTextPosition.Bottom;
WxProvider.Style.PictureMarginTop := -10;
WxProvider.PinPosition := New GxPointF.Create(50, 50);
WxProvider.Extension := WxETLProvider As IWxShapeExtension;
//End of visual object creation
//Save Etl task
MObj.Save;
End Sub Main;
After executing the example the Custom Source object is created in the ETL task. The source imports data, obtained according to custom algorithm, that is implemented in the redefined method Fetch in the MyProvider class.
See also: