Dataset: IDatasetModel;
The Dataset property determines a table MDM dictionary that is used as a data provider.
Executing the example requires that the repository contains an ETL task with the ETL_Task identifier and a table MDM dictionary with the RDS_DICT identifier.
Add links to the Andy, Db, Drawing, Dt, Etl, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
ETLTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
DtRds: IDtRdsProvider;
Begin
MB := MetabaseClass.Active;
ETLTask := MB.ItemById("ETL_Task").Edit As IEtlTask;
//Create a new data provider - table MDM dictionary
EtlProvider := ETLTask.Create(EtlObjectType.PlainDataRdsProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit;
EtlProvider.Id := "RDS_Provider";
EtlProvider.Name := "Источник - Table MDM dictionary";
//Create a visual source object
CreateWX(ETLTask, EtlProvider, 0, 0);
//Set up source
DtRds := EtlProvider.Provider As IDtRdsProvider;
DtRds.Dataset := Mb.ItemById("RDS_DICT").Bind As IDatasetModel;
//Save source
EtlProvider.Save;
//Save task
(ETLTask As IMetabaseObject).Save;
End Sub UserProc;
//Create a visual object
Sub CreateWX(ETLTask: IEtlTask; ETLObject: IEtlObject; XPosition: Integer; YPosition: Integer);
Var
WxRect: IWxRectangle;
WxETLObj: IWxEtlObject;
Begin
WxRect := ETLTask.Workspace.CreateRectangle;
WxRect.Id := ETLObject.Id;
WxETLObj := New WxEtlObject.Create;
WxETLObj.EtlObject := ETLObject;
WxRect.Style.TextPosition := WxTextPosition.Bottom;
WxRect.Style.PictureMarginTop := -10;
WxRect.PinPosition := New GxPointF.Create(XPosition, YPosition);
WxRect.Extension := WxETLObj As IWxShapeExtension;
End Sub CreateWX;
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Etl;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
ETLTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
DtRds: IDtRdsProvider;
Begin
MB := Params.Metabase;
ETLTask := MB.ItemById["ETL_Task"].Edit() As IEtlTask;
//Create a new data provider - table MDM dictionary
EtlProvider := ETLTask.Create(EtlObjectType.eotPlainDataRdsProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit();
EtlProvider.Id := "RDS_Provider";
EtlProvider.Name := "Источник - Table MDM dictionary";
//Create a visual source object
CreateWX(ETLTask, EtlProvider, 0, 0);
//Set up source
DtRds := EtlProvider.Provider As IDtRdsProvider;
DtRds.Dataset := Mb.ItemById["RDS_DICT"].Bind() As IDatasetModel;
//Save source
EtlProvider.Save();
//Save task
(ETLTask As IMetabaseObject).Save();
End Sub;
//Create visual objects
Public Shared Sub CreateWX(ETLTask: IEtlTask; ETLObject: IEtlObject; XPosition: Integer; YPosition: Integer);
Var
GxPointFCls: GxPointF = New GxPointFClass();
WxRect: IWxRectangle;
WxETLObj: IWxEtlObject = New WxEtlObject();
Begin
WxRect := ETLTask.Workspace.CreateRectangle();
WxRect.Id := ETLObject.Id;
WxETLObj.EtlObject := ETLObject;
WxRect.Style.TextPosition := WxTextPosition.wtpBottom;
WxRect.Style.PictureMarginTop := -10;
GxPointFCls.Create(XPosition, YPosition);
WxRect.PinPosition := GxPointFCls;
WxRect.Extension := WxETLObj As IWxShapeExtension;
End Sub;
After executing the example, a new data provider is created in the ETL task that is connected with the specified table MDM dictionary.
See also: