ForeClass: String;
The ForeClass property determines the name of 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 provider 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 provider 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";
//Set up data provider
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;
//Save provider
EtlProvider.Save;
//End of provider 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 provider imports data, obtained according to custom algorithm, that is implemented in the redefined method Fetch in the MyProvider class.
See also: