UserData: IXmlDomElement;
UserData: Prognoz.Platform.Interop.MsXml2.IXmlDomElement;
The UserData property determines additional settings in the XML format for custom data provider.
Advanced settings are set in the IDtRecordsetUserData interface of the class which implements this interface and the IDtRecordsetProvider interface.
Features of work with the XML files are presented on theExample of Working with XML Files page.
Executing the example requires that the repository have:
ETL task with the ETL identifier.
Module with the MYPROVIDER identifier. The module contains class implementing the IDtRecordsetProvider, IDtRecordsetUserData interfaces. The class example 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;
EtlProvider: IEtlPlainDataProvider;
UserProvider: IDtUserProvider;
WxProvider: IWxRectangle;
WxETLProvider: IWxETLObject;
Fields: IDtFieldDefinitions;
Field: IDtFieldDefinition;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get ETL task
EtlTask := MB.ItemById("ETL").Edit As IEtlTask;
//Create the User source object in the ETL task
EtlProvider := EtlTask.Create(EtlObjectType.PlainDataUserProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit;
EtlProvider.Id := "User_Provider";
EtlProvider.Name := "User source";
EtlProvider.Description := "User source";
//Setup data source
UserProvider := EtlProvider.Provider As IDtUserProvider;
UserProvider.ForeModule := MB.ItemById("MYPROVIDER").Bind;
UserProvider.ForeClass := "MyProvider";
Debug.WriteLine("Custom data in the XML format" + UserProvider.UserData.xml);
Fields := UserProvider.Fields;
Field := Fields.Add;
Field.DataType := DbDataType.String;
Field.Name := "Name";
Field := Fields.Add;
Field.DataType := DbDataType.Float;
Field.Name := "Value";
EtlProvider.FillDefault;
//Save settings of data source
EtlProvider.Save;
// Create visual view of the object in the ETL task
WxProvider := EtlTask.Workspace.CreateRectangle;
WxETLProvider := New WxETLObject.Create;
WxETLProvider.ETLObject := EtlProvider;
WxProvider.Style.TextPosition := WxTextPosition.Bottom;
WxProvider.Style.PictureMarginTop := -10;
WxProvider.PinPosition := New GxPointF.Create(50, 50);
WxProvider.Extension := WxETLProvider As IWxShapeExtension;
//Save changes
(EtlTask As IMEtabaseObject).Save;
End Sub UserProc;
After executing the example, custom data source basing on specified class is created in the ETL task. The console displays custom data in the XML format.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Etl;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
EtlTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
UserProvider: IDtUserProvider;
WxProvider: IWxRectangle;
WxETLProvider: WxETLObject = New WxETLObjectClass();
PointF: GxPointF = New GxPointFClass();
Fields: IDtFieldDefinitions;
Field: IDtFieldDefinition;
Begin
// Get repository
MB := Params.Metabase;
// Get ETL task
EtlTask := MB.ItemById["ETL"].Edit() As IEtlTask;
//Create the User source object in the ETL task
EtlProvider := EtlTask.Create(EtlObjectType.eotPlainDataUserProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit();
EtlProvider.Id := "User_Provider";
EtlProvider.Name := "User source";
EtlProvider.Description := "User source";
//Setup data source
UserProvider := EtlProvider.Provider As IDtUserProvider;
UserProvider.ForeModule := MB.ItemById["MYPROVIDER"].Bind();
UserProvider.ForeClass := "MyProvider";
System.Diagnostics.Debug.WriteLine("Custom data in the XML format" + UserProvider.UserData.xml);
Fields := UserProvider.Fields;
Field := Fields.Add();
Field.DataType := DbDataType.ddtString;
Field.Name := "Name";
Field := Fields.Add();
Field.DataType := DbDataType.ddtFloat;
Field.Name := "Value";
EtlProvider.FillDefault();
//Save settings of data source
EtlProvider.Save();
// Create visual view of the object in the ETL task
WxProvider := EtlTask.Workspace.CreateRectangle();
WxETLProvider.ETLObject := EtlProvider;
WxProvider.Style.TextPosition := WxTextPosition.wtpBottom;
WxProvider.Style.PictureMarginTop := -10;
PointF.Create(50, 50);
WxProvider.PinPosition := PointF;
WxProvider.Extension := WxETLProvider As IWxShapeExtension;
//Save changes
(EtlTask As IMEtabaseObject).Save();
End Sub;
See also: