ForeClass: String;
The ForeClass property determines the name of the class that implements user consumer.
Executing the example requires that the repository contains an ETL task with the Etl identifier and the ModuleConsumer module, containing the MyConsumer class, that implements user consumer. The consumer is supposed to work with the array, that contains symbolic and real values.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlConsumer: IEtlPlainDataConsumer;
UserConsumer: IDtUserConsumer;
WxConsumer: IWxRectangle;
WxETLConsumer: 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 consumer creation
//The Custom Consumer object creation
EtlConsumer := EtlTask.Create(EtlObjectType.PlainDataUserConsumer) As IEtlPlainDataConsumer;
EtlConsumer := EtlConsumer.Edit;
EtlConsumer.Id := "User_Consumer";
EtlConsumer.Name := "User consumer";
EtlConsumer.Description := "User consumer";
//Set up data consumer
UserConsumer := EtlConsumer.Consumer As IDtUserConsumer;
UserConsumer.ForeModule := MB.ItemById("ModuleConsumer").Bind As IModule;
UserConsumer.ForeClass := "MyConsumer";
Fields := UserConsumer.Fields;
Field := Fields.Add;
Field.DataType := DbDataType.String;
Field.Name := "Code";
Field := Fields.Add;
Field.DataType := DbDataType.Float;
Field.Name := "Value";
EtlConsumer.FillDefault;
//Save consumer
EtlConsumer.Save;
//End of consumer 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 Main;
After executing the example the Custom Consumer object is created in the ETL task. The consumer exports data according to custom algorithm, that is implemented in the redefined method Put in the MyConsumer class.
See also: