ForeClass: String;
The ForeClass property determines the name of the class that implements custom provider.
Executing the example requires the repository that contains:
ETL task with the ETL identifier.
Unit with the MYPROVIDER identifier. The unit contains a class implementing the IDtRecordsetProvider, IDtRecordsetUserData interfaces. The class example is given in description of IDtRecordsetUserData.UserData.
Add links to the Andy, Dal, Drawing, Dt, Etl, Metabase, Xml system assemblies.
Sub UserProc;
Var
MB: IMetabase;
EtlTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
UserProvider: IDtUserProvider;
WxProvider: IWxRectangle;
WxETLProvider: IWxETLObject;
Fields: IDtFieldDefinitions;
Field: IDtFieldDefinition;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get ETL task
EtlTask := MB.ItemById("ETL").Edit As IEtlTask;
// Create the User Provider object in the ETL task
EtlProvider := EtlTask.Create(EtlObjectType.PlainDataUserProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit;
EtlProvider.Id := "User_Provider";
EtlProvider.Name := "User provider";
EtlProvider.Description := "User provider";
// Set up data provider
UserProvider := EtlProvider.Provider As IDtUserProvider;
UserProvider.ForeModule := MB.ItemById("MYPROVIDER").Bind;
UserProvider.ForeClass := "MyProvider";
Debug.WriteLine("Custom data in the XML format: " + UserProvider.UserData.xml);
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 data provider settings
EtlProvider.Save;
// Create visual view of the object in the ETL task
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;
// Save changes
(EtlTask As IMEtabaseObject).Save;
End Sub UserProc;
After executing the example, a user data provider based on the specified class is created in the ETL task. The console displays custom data in the XML format.
See also: