IDtUserConsumer.UserData

Syntax

UserData: IXmlDomElement;

Description

The UserData property determines additional settings in the XML format for custom data consumer.

Comments

Advanced settings are determined in the IDtRecordsetUserData interface of the class that implements this interface and the IDtRecordsetConsumer interface.

Features of work with the XML files are presented on theExample of Working with XML Files page.

Example

Executing the example requires that the repository contains an ETL task with the ETL identifier and a unit with the MYCONSUMER identifier. The module contains class implementing the IDtRecordsetConsumer, IDtRecordsetUserData interfaces. The example of the IDtRecordsetUserData interface use 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;
    EtlConsumer: IEtlPlainDataConsumer;
    UserConsumer: IDtUserConsumer;
    WxConsumer: IWxRectangle;
    WxETLConsumer: IWxETLObject;
    Fields: IDtFieldDefinitions;
    Field: IDtFieldDefinition;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Get ETL task
    EtlTask := MB.ItemById("ETL").Edit As IEtlTask;
    // Create the User Consumer object in ETL task
    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("MYCONSUMER").Bind;
    UserConsumer.ForeClass := "MyConsumer";
    Debug.WriteLine("Custom data in the XML format" + UserConsumer.UserData.xml);
    Fields := UserConsumer.Fields;
    Field := Fields.Add;
    Field.DataType := DbDataType.String;
    Field.Name := "Name";
    Field := Fields.Add;
    Field.DataType := DbDataType.Float;
    Field.Name := "Value";
    EtlConsumer.FillDefault;
    // Save data consumer settings
    EtlConsumer.Save;
    // Create visual view of the object in the ETL task
    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;
    // Save changes
    (EtlTask As IMEtabaseObject).Save;
End Sub UserProc;

After executing the example, custom data consumer basing on specified class is created in the ETL task. The console displays custom data in the XML format.

See also:

IDtUserConsumer