Dataset: IDatasetModel;
The Dataset property determines repository relational object, with which the data consumer is connected.
Executing the example requires that the repository contains the ETL task with the ETL identifier and a table with the TABLE identifier.
Add links to the Andy, Db, Drawing, Dt, Etl, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlConsumer: IEtlPlainDataConsumer;
MBConsumer: IDtMetabaseConsumer;
Tab: IDatasetModel;
Fields: IDatasetModelFields;
WxConsumer: IWxRectangle;
WxETLConsumer: IWxETLObject;
Begin
MB := MetabaseClass.Active;
// ETL task search. Repository object with the ETL identifier
MObj := MB.ItemById("ETL").Edit;
Tab := MB.ItemById("TABLE").Bind As IDatasetModel;
Fields := Tab.Fields;
EtlTask := MObj As IEtlTask;
// Start of repository data consumer
// Create the Repository Consumer object
EtlConsumer := EtlTask.Create(EtlObjectType.PlainDataMetabaseConsumer) As IEtlPlainDataConsumer;
EtlConsumer := EtlConsumer.Edit;
EtlConsumer.Id := "MB_CONSUMER";
EtlConsumer.Name := "Repository data consumer";
EtlConsumer.Description := "Repository data consumer";
// Set up data consumer
MBConsumer := EtlConsumer.Consumer As IDtMetabaseConsumer;
MBConsumer.Dataset := Tab;
MBConsumer.CatchAddRecordException := True;
EtlConsumer.FillDefault;
EtlConsumer.KeyFieldNames := Fields.Item(0).Id;
// Save repository data consumer
EtlConsumer.Save;
// End of repository data 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 UserProc;
After executing the example in the ETL task the Repository Consumer object is created. The consumer will be linked with the TABLE repository table. During data export entries are updated by the content of the first table field.
See also: