IDtMetabaseConsumer.Dataset

Syntax

Dataset: IDatasetModel;

Fore.NET Syntax

Dataset: Prognoz.Platform.Interop.Db.IDatasetModel;

Description

The Dataset property determines repository relational object, with which the data consumer is connected.

Comments

To determine repository relational object, with which the data consumer is connected, use the IDtMetabaseProvider.Dataset property.

Fore example

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 Main;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    EtlTask: IEtlTask;
    EtlConsumer: IEtlPlainDataConsumer;
    MBConsumer: IDtMetabaseConsumer;
    Tab: IDatasetModel;
    Fields: IDatasetModelFields;
    WxConsumer: IWxRectangle;
    WxETLConsumer: IWxETLObject;
Begin
    MB := MetabaseClass.Active;
    
//Searching ETL task. 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 creating repository 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";
    
//Setup data consumer
    MBConsumer := EtlConsumer.Consumer As IDtMetabaseConsumer;
    MBConsumer.Dataset := Tab;
    MBConsumer.CatchAddRecordException := 
True;
    EtlConsumer.FillDefault;
    EtlConsumer.KeyFieldNames := Fields.Item(
0).Id;
    
//Save repository consumer
    EtlConsumer.Save;
    
//End of creating repository consumer
    //Start of visual object creating
    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(5050);
    WxConsumer.Extension := WxETLConsumer 
As IWxShapeExtension;
    
//End of visual object creating
    //Saving ETL task
    MObj.Save;
End Sub Main;

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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Etl;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Drawing;
...
Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    EtlTask: IEtlTask;
    EtlConsumer: IEtlPlainDataConsumer;
    MBConsumer: IDtMetabaseConsumer;
    Tab: IDatasetModel;
    Fields: IDatasetModelFields;
    WxConsumer: IWxRectangle;
    WxETLConsumer: IWxETLObject;
    PinPosition: GxPointF = New GxPointFClass();
Begin
    MB := Params.Metabase;
    //Search of ETL task. 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 creating repository consumer
    //Creating the Repository Consumer object
    EtlConsumer := EtlTask.Create(EtlObjectType.eotPlainDataMetabaseConsumer) As IEtlPlainDataConsumer;
    EtlConsumer := EtlConsumer.Edit();
    EtlConsumer.Id := "MB_CONSUMER";
    EtlConsumer.Name := "Repository data consumer";
    EtlConsumer.Description := "Repository data consumer";
    //Setup data consumer
    MBConsumer := EtlConsumer.Consumer As IDtMetabaseConsumer;
    MBConsumer.Dataset := Tab;
    MBConsumer.CatchAddRecordException := True;
    EtlConsumer.FillDefault();
    EtlConsumer.KeyFieldNames := Fields.Item[0].Id;
    //Save repository consumer
    EtlConsumer.Save();
    //End of creating repository consumer
    //Start of visual object creating
    WxConsumer := EtlTask.Workspace.CreateRectangle();
    WxETLConsumer := New WxETLObject.Create();
    WxETLConsumer.ETLObject := EtlConsumer;
    WxConsumer.Style.TextPosition := WxTextPosition.wtpBottom;
    WxConsumer.Style.PictureMarginTop := -10;
    PinPosition := WxConsumer.PinPosition;
    PinPosition.Create(5050);
    WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;
    //End of visual object creating
    //Saving ETL task
    MObj.Save();
    End Sub;

See also:

IDtMetabaseConsumer