UserData: IXmlDomElement;
UserData: Prognoz.Platform.Interop.MsXml2.IXmlDomElement;
The UserData property returns element of XML document object model.
Features of work with XML files are presented on the Example of Working with XML Files page.
Executing the example requires that the repository contains a Fore form with the FORMUSERPROV identifier containing the following components:
Memo with the Memo1 identifier.
Button with the Button1 identifier.
The form contains the following classes:
Class of description of the form used as one of the pages of user provider edit wizard.
Class to connect this form.
Add links to the Collections, Dt, Etl, MathFin, Metabase, Xml system assemblies.
<font color="#007800">{ Class of form description }</font><br /> <font color="#007878">Class</font> FormUserProvForm: Form, IEtlForeWizardPage<br /> Memo1: Memo;<br /> Button1: Button;<br /> Model: IEtlUserDataContainer;<br /> <br /> <font color="#007800">{IEtlForeWizardPage}</font><br /> <font color="#007878">Public</font> <font color="#007878">Function</font> OnSetActive: Boolean;<br /> <font color="#007878">Begin</font><br /> memo1.Clear;<br /> memo1.Lines.Add(Model.UserData.xml);<br /> <font color="#007878">Return</font> <font color="#007878">True</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> OnSetActive;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> OnWizardNext: Integer;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007800">0</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> OnWizardNext;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> OnWizardBack: Integer;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007800">0</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> OnWizardBack;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> IsLeaveAllowed: Boolean;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007878">True</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> IsLeaveAllowed;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> IsDoneAllowed: Boolean;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007878">False</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> IsDoneAllowed;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> set_Model(m: IEtlUserDataContainer);<br /> <font color="#007878">Begin</font><br /> Model := m;<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> set_Model;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> get_Title: String;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#780000">"CrPage"</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> get_Title;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> set_Title(t: String);<br /> <font color="#007878">Begin</font><br /> <font color="#007878">End</font> <font color="#007878">Sub</font> set_Title;<br /> <br /> <font color="#007878">Sub</font> Set_ModelData;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">End</font> <font color="#007878">Sub</font> Set_ModelData;<br /> <br /> <font color="#007800">{Click on the button}</font><br /> <font color="#007878">Sub</font> Button1OnClick(Sender: Object; Args: IMouseEventArgs);<br /> <font color="#007878">Begin</font><br /> <font color="#007878">If</font> <font color="#007878">Not</font> Model.IsDirty <font color="#007878">Then</font><br /> Model.SetDirty(<font color="#007878">True</font>);<br /> <font color="#007878">End</font> <font color="#007878">If</font>;<br /> Model.UserData.setAttribute(<font color="#780000">"NewValue"</font>, <font color="#780000">"Value"</font>);<br /> memo1.Lines.Add(<font color="#780000">"------------------------------"</font>);<br /> memo1.Lines.Add(Model.UserData.xml);<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> Button1OnClick;<br /> <br /> <font color="#007878">End</font> <font color="#007878">Class</font> FormUserProvForm;<br /> <br /> <font color="#007800">{ Class to connect form as one of edit wizard page<br /> user provider }</font><br /> <font color="#007878">Class</font> MyProvider: Object, IDtRecordsetProvider, IEtlForeWizardPages, IDtRecordsetUserData<br /> userD: IXmlDomElement;<br /> randMax: integer;<br /> meta: IMetabase;<br /> <br /> <font color="#007800">{IDtRecordsetProvider}</font><br /> <font color="#007878">Public</font> <font color="#007878">Function</font> Fetch: Array <font color="#007878">Of</font> Variant;<br /> <font color="#007878">Var</font><br /> ResArray: Array[<font color="#007800">0</font>..<font color="#007800">1</font>, <font color="#007800">0</font>..<font color="#007800">100</font>] <font color="#007878">Of</font> Variant;<br /> i, j: integer;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">For</font> j := <font color="#007800">0</font> <font color="#007878">To</font> <font color="#007800">100</font> <font color="#007878">Do</font><br /> <font color="#007878">For</font> i := <font color="#007800">0</font> <font color="#007878">To</font> <font color="#007800">1</font> <font color="#007878">Do</font><br /> <font color="#007878">If</font> i = <font color="#007800">0</font> <font color="#007878">Then</font><br /> ResArray[i, j] := <font color="#780000">"Code-"</font> + j.ToString;<br /> <font color="#007878">Else</font><br /> ResArray[i, j] := Math.RandBetween(<font color="#007800">0</font>, randMax);<br /> <font color="#007878">End</font> <font color="#007878">If</font>;<br /> <font color="#007878">End</font> <font color="#007878">For</font>;<br /> <font color="#007878">End</font> <font color="#007878">For</font>;<br /> <font color="#007878">Return</font> ResArray;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> Fetch;<br /> <br /> <font color="#007800">{IEtlForeWizardPages}</font><br /> <font color="#007878">Public</font> <font color="#007878">Function</font> Item(index: Integer): IMetabaseObjectDescriptor;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> meta.ItemById(<font color="#780000">"FORMUSERPROV"</font>);<br /> <font color="#007878">End</font> <font color="#007878">Function</font> Item;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> get_Count: Integer;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007800">1</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> get_Count;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> get_Metabase: IMetabase;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> meta;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> get_Metabase;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> set_Metabase(metabase: IMetabase);<br /> <font color="#007878">Begin</font><br /> meta := metabase;<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> set_Metabase;<br /> <br /> <font color="#007800">{IDtRecordsetUserData}</font><br /> <font color="#007878">Public</font> <font color="#007878">Function</font> get_userData: IXmlDomElement;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> UserD;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> get_userData;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> set_userData(value: IXmlDomElement);<br /> <font color="#007878">Begin</font><br /> UserD := value;<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> set_userData;<br /> <br /> <font color="#007878">End</font> <font color="#007878">Class</font> MyProvider;
Executing the example requires that the repository contains an ETL task with the ETLT identifier.
Example of connecting unit and class
Add links to the system assemblies: Andy, Drawing, Dt, Etl, Metabase. SubUserProc; Var MB:IMetabase; MObj:IMetabaseObject; EtlTask:IEtlTask; DataUserProvider:IEtlPlainDataUserProvider; UserProvider:IDtUserProvider; Begin //Get the MB repository:=MetabaseClass.Active; //Get the ETL task MObj:=MB.ItemById("ETLT").Edit; EtlTask:=MObjAsIEtlTask; //Create the User Provider object" DataUserProvider:=EtlTask.Create(EtlObjectType.PlainDataUserProvider)AsIEtlPlainDataUserProvider; //Determine provider name DataUserProvider.Name:="User Provider"; //Connect module and class for user provider UserProvider:=DataUserProvider.ProviderAsIDtUserProvider; UserProvider.ForeModule:=MB.ItemById("FORMUSERPROV").Edit; UserProvider.ForeClass:="MyProvider"; //Visual view of the provider in the task CreateWXP(DataUserProvider,EtlTask); //Save changes Mobj.Save; EndSubUserProc; {Create visual object of data provider } SubCreateWXP(CopyObj:IEtlPlainDataProvider;Etltask:IEtltask); Var WxDataTrans:IWxRectangle; WxETLDataTrans:IWxEtlObject; Begin WxDataTrans:=EtlTask.Workspace.CreateRectangle; WxDataTrans.Id:=CopyObj.Id; WxETLDataTrans:=NewWxEtlObject.Create; WxETLDataTrans.EtlObject:=CopyObj; WxDataTrans.Style.TextPosition:=WxTextPosition.Bottom; WxDataTrans.Style.PictureMarginTop:=-10; WxDataTrans.PinPosition:=NewGxPointF.Create(20,20); WxDataTrans.Extension:=WxETLDataTransAsIWxShapeExtension; EndSubCreateWXP;
After executing the example a source object is created in the specified ETL task. A new page named CrPage is created in the source edit wizard. On moving to this page the Memo1 component displays the current model XML data.
On the CrPage page on the button click:
The Memo1 component displays changed XML data.
The IEtlUserDataContainer.SetDirty property is set to True, that is, confirmation window opens on closing edit wizard window if there are not changes made.
Due to features of implementation of user provider interface, the Fore.NET example uses the IEtlPlainDataUserProvider.ExMode property, that is why form code and unit and class connection example differ strongly from the Fore example.
Executing the example requires that the repository contains a Fore.NET assembly with the FORMUSERPROVNET identifier containing a form. The form contains the components:
TextBox with the TextBox1 identifier.
Button with the Button1 identifier.
The form contains the following classes:
Class of description of the form used as one of edit wizard pages.
Class to connect this form.
<font color="#007878">Imports</font> Prognoz.Platform.Interop.Dt;<br /> <font color="#007878">Imports</font> Prognoz.Platform.Interop.Etl;<br /> <font color="#007878">Imports</font> Prognoz.Platform.Interop.MsXml2;<br /> …<br /> <font color="#007800">{ Class of form description }</font><br /> <font color="#007878">Public</font> <font color="#007878">Partial</font> <font color="#007878">Class</font> FORMUSERPROV_NETForm: Prognoz.Platform.Forms.Net.ForeNetForm, IEtlForeWizardPage<br /> Modell: IEtlUserDataContainer;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Constructor</font> FORMUSERPROV_NETForm();<br /> <font color="#007878">Begin</font><br /> InitializeComponent();<br /> <font color="#007878">End</font> <font color="#007878">Constructor</font>;<br /> <br /> <font color="#007800">{IEtlForeWizardPage}</font><br /> <font color="#007878">Public</font> <font color="#007878">Function</font> OnSetActive(): Boolean;<br /> <font color="#007878">Begin</font><br /> TextBox1.Clear();<br /> TextBox1.Text := Model.UserData.xml;<br /> <font color="#007878">Return</font> <font color="#007878">True</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> OnSetActive;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> OnWizardNext(): Integer;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007800">0</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> OnWizardNext;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> OnWizardBack(): Integer;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007800">0</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> OnWizardBack;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> IsLeaveAllowed(): Boolean;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007878">True</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> IsLeaveAllowed;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> IsDoneAllowed(): Boolean;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007878">False</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> IsDoneAllowed;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Property</font> Title: String<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#780000">"CrPage"</font>;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">Set</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">End</font> <font color="#007878">Set</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> Title;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Property</font> Model: IEtlUserDataContainer<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> Modell;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">Set</font><br /> <font color="#007878">Begin</font><br /> Modell := model;<br /> <font color="#007878">End</font> <font color="#007878">Set</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> Model;<br /> <br /> <font color="#007800">{Button1OnClick}</font><br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> button1_Click(sender: System.Object; e: System.EventArgs);<br /> <font color="#007878">Begin</font><br /> <font color="#007878">If</font> <font color="#007878">Not</font> Model.IsDirty() <font color="#007878">Then</font><br /> Model.SetDirty(<font color="#007878">True</font>);<br /> <font color="#007878">End</font> <font color="#007878">If</font>;<br /> TextBox1.Clear();<br /> Model.UserData.setAttribute(<font color="#780000">"NewValue"</font>, <font color="#780000">"Value"</font>);<br /> TextBox1.Text := Model.UserData.xml;<br /> <font color="#007878">End</font> <font color="#007878">Sub</font>;<br /> <br /> <font color="#007878">End</font> <font color="#007878">Class</font>;<br /> <br /> <font color="#007800">{ Class to connect form as one of pages of edit wizard<br /> of user provider }</font><br /> <font color="#007878">Public</font> <font color="#007878">Class</font> MyUserProvider: IDtCustomProvider, IEtlForeWizardPages<br /> p: IDtTextProvider;<br /> m_active: boolean;<br /> meta: IMetabase;<br /> <br /> <font color="#007800">{IDtCustomProvider}</font><br /> <font color="#007878">Public</font> <font color="#007878">Property</font> Eof: Boolean<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> p.Eof;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> Eof;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> Fetch(<font color="#007878">Var</font> Values: Array);<br /> <font color="#007878">Begin</font><br /> p.Fetch(<font color="#007878">Var</font> Values);<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> Fetch;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> FetchRows(Count: Integer; <font color="#007878">Var</font> Values: Array): Integer;<br /> <font color="#007878">Var</font><br /> i: Integer;<br /> <font color="#007878">Begin</font><br /> i := p.FetchRows(Count, <font color="#007878">Var</font> Values);<br /> <font color="#007878">Return</font> i;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> FetchRows;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> ImplementFetchRows(): Boolean;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007878">True</font>;<br /> <font color="#007878">End</font> <font color="#007878">Function</font> ImplementFetchRows;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> ReadingRowsCount(): Integer;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> p.ReadingRowsCount();<br /> <font color="#007878">End</font> <font color="#007878">Function</font> ReadingRowsCount;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> Open();<br /> <font color="#007878">Begin</font><br /> m_Active := <font color="#007878">True</font>;<br /> <font color="#007878">If</font> p = <font color="#007878">Null</font> <font color="#007878">Then</font><br /> p := <font color="#007878">New</font> DtTextProvider.Create();<br /> <font color="#007878">End</font> <font color="#007878">If</font>;<br /> FieldsFromFile();<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> Open;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> Close();<br /> <font color="#007878">Begin</font><br /> m_Active := <font color="#007878">False</font>;<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> Close;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> Save(Element: IXMLDOMElement);<br /> <font color="#007878">Begin</font><br /> p.Save(Element);<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> Save;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> Load(Element: IXMLDOMElement);<br /> <font color="#007878">Begin</font><br /> <font color="#007878">If</font> p = <font color="#007878">Null</font> <font color="#007878">Then</font><br /> p := <font color="#007878">New</font> DtTextProvider.Create();<br /> <font color="#007878">End</font> <font color="#007878">If</font>;<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> Load;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> FieldsFromFile();<br /> <font color="#007878">Begin</font><br /> p.FieldsFromFile();<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> FieldsFromFile;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> ClearFields();<br /> <font color="#007878">Begin</font><br /> p.ClearFields();<br /> <font color="#007878">End</font> <font color="#007878">Sub</font> ClearFields;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> SaveToSerializer(Serializer: IMetabaseSerializer);<br /> <font color="#007878">Begin</font><br /> <font color="#007878">End</font> <font color="#007878">Sub</font> SaveToSerializer;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> LoadFromSerializer(Serializer: IMetabaseSerializer);<br /> <font color="#007878">Begin</font><br /> <font color="#007878">End</font> <font color="#007878">Sub</font> LoadFromSerializer;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> FieldsFromFileEx();<br /> <font color="#007878">Begin</font><br /> <font color="#007878">End</font> <font color="#007878">Sub</font> FieldsFromFileEx;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Sub</font> OpenO(Options: Integer);<br /> <font color="#007878">Begin</font><br /> <font color="#007878">End</font> <font color="#007878">Sub</font> OpenO;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Property</font> Active: Boolean<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> m_Active;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> Active;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Property</font> GetType: DtObjectType<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> DtObjectType.TDtExcelProvider;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> GetType;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Property</font> FieldsO[Options: Integer]: DtFieldDefinitions<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007878">Null</font>;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> FieldsO;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Property</font> KeepCalcFields: Boolean<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> p.KeepCalcFields;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">Set</font><br /> <font color="#007878">Begin</font><br /> p.KeepCalcFields := value;<br /> <font color="#007878">End</font> <font color="#007878">Set</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> KeepCalcFields;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Property</font> Fields: DtFieldDefinitions<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">If</font> p = <font color="#007878">Null</font> <font color="#007878">Then</font><br /> p := <font color="#007878">New</font> DtTextProvider.Create();<br /> p.File := <font color="#780000">"C:\Data_Out.txt"</font>;<br /> p.RangeHasHeader := <font color="#007878">True</font>;<br /> p.DelimitedColumnDelimiter := <font color="#780000">"#"</font>;<br /> p.Open();<br /> <font color="#007878">End</font> <font color="#007878">If</font>;<br /> <font color="#007878">Return</font> p.Fields;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> Fields;<br /> <br /> <font color="#007800">{IEtlForeWizardPages}</font><br /> <font color="#007878">Public</font> <font color="#007878">Property</font> Count: Integer<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> <font color="#007800">1</font>;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> Count;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Function</font> Item(index: Integer): IMetabaseObjectDescriptor;<br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> meta.ItemById[<font color="#780000">"FORMUSERPROVNET"</font>];<br /> <font color="#007878">End</font> <font color="#007878">Function</font> Item;<br /> <br /> <font color="#007878">Public</font> <font color="#007878">Property</font> Metabase: IMetabase<br /> <font color="#007878">Get</font><br /> <font color="#007878">Begin</font><br /> <font color="#007878">Return</font> meta;<br /> <font color="#007878">End</font> <font color="#007878">Get</font><br /> <font color="#007878">Set</font><br /> <font color="#007878">Begin</font><br /> meta := value;<br /> <font color="#007878">End</font> <font color="#007878">Set</font><br /> <font color="#007878">End</font> <font color="#007878">Property</font> Metabase;<br /> <br /> <font color="#007878">End</font> <font color="#007878">Class</font> MyUserProvider;
Executing the example requires that the repository contains:
An ETL task with the ETLT identifier.
A text file named Data_Out.txt that must be located in the root of the C:\ disc.
Contents of the Data_Out.txt file
KEY#COUNTRY_NAME#OWNER
512#"Afganistan"#3
914#"Albania"#3
612#"Algeria"#2
1#"word1"#3
2#"word2"#4
3#"word3"#5
4#"word4"#6
5#"word5"#7
6#"word6"#8
7#"word7"#9
8#"word8"#10
9#"word9"#11
10#"word10"#12
11#"word11"#13
12#"word12"#14
13#"word13"#15
14#"word14"#16
15#"word15"#17
16#"word16"#18
17#"word17"#19
18#"word18"#20
19#"word19"#21
20#"word20"#22
21#"word21"#23
22#"word22"#24
23#"word23"#25
24#"word24"#26
25#"word25"#27
26#"word26"#28
27#"word27"#29
28#"word28"#30
29#"word29"#31
30#"word30"#32
31#"word31"#33
32#"word32"#34
33#"word33"#35
34#"word34"#36
35#"word35"#37
36#"word36"#38
incorrect#"word37"#39
incorrect#"word38"#40
incorrect#"word39"#41
incorrect#"word40"#42
incorrect#"word41"#43
incorrect#"word42"#44
incorrect#"word43"#45
incorrect#"word44"#46
incorrect#"word45"#47
incorrect#"word46"#48
incorrect#"word47"#49
incorrect#"word48"#50
incorrect#"word49"#51
incorrect#"word50"#52
incorrect#"word51"#53
incorrect#"word52"#54
incorrect#"word53"#55
incorrect#"word54"#56
incorrect#"word55"#57
incorrect#"word56"#58
incorrect#"word57"#59
incorrect#"word58"#60
incorrect#"word59"#61
incorrect#"word60"#62
incorrect#"word61"#63
incorrect#"word62"#64
incorrect#"word63"#65
incorrect#"word64"#66
incorrect#"word65"#67
incorrect#"word66"#68
incorrect#"word67"#69
incorrect#"word68"#70
incorrect#"word69"#71
incorrect#"word70"#72
incorrect#"word71"#73
incorrect#"word72"#74
incorrect#"word73"#75
incorrect#"word74"#76
incorrect#"word75"#77
incorrect#"word76"#78
incorrect#"word77"#79
incorrect#"word78"#80
incorrect#"word79"#81
incorrect#"word80"#82
incorrect#"word81"#83
incorrect#"word82"#84
incorrect#"word83"#85
incorrect#"word84"#86
incorrect#"word85"#87
incorrect#"word86"#88
incorrect#"word87"#89
incorrect#"word88"#90
incorrect#"word89"#91
incorrect#"word90"#92
incorrect#"word91"#93
incorrect#"word92"#94
incorrect#"word93"#95
incorrect#"word94"#96
incorrect#"word95"#97
incorrect#"word96"#98
incorrect#"word97"#99
incorrect#"word98"#100
incorrect#"word99"#101
incorrect#"word100"#102
incorrect#"word101"#103
incorrect#"word102"#104
incorrect#"word103"#105
incorrect#"word104"#106
incorrect#"word105"#107
incorrect#"word106"#108
incorrect#"word107"#109
incorrect#"word108"#110
incorrect#"word109"#111
incorrect#"word110"#112
incorrect#"word111"#113
incorrect#"word112"#114
incorrect#"word113"#115
incorrect#"word114"#116
incorrect#"word115"#117
incorrect#"word116"#118
incorrect#"word117"#119
incorrect#"word118"#120
incorrect#"word119"#121
incorrect#"word120"#122
incorrect#"word121"#123
incorrect#"word122"#124
incorrect#"word123"#125
incorrect#"word124"#126
incorrect#"word125"#127
incorrect#"word126"#128
incorrect#"word127"#129
incorrect#"word128"#130
incorrect#"word129"#131
incorrect#"word130"#132
incorrect#"word131"#133
incorrect#"word132"#134
incorrect#"word133"#135
incorrect#"word134"#136
incorrect#"word135"#137
incorrect#"word136"#138
incorrect#"word137"#139
incorrect#"word138"#140
incorrect#"word139"#141
incorrect#"word140"#142
incorrect#"word141"#143
incorrect#"word142"#144
incorrect#"word143"#145
incorrect#"word144"#146
incorrect#"word145"#147
incorrect#"word146"#148
incorrect#"word147"#149
incorrect#"word148"#150
incorrect#"word149"#151
incorrect#"word150"#152
incorrect#"word151"#153
incorrect#"word152"#154
incorrect#"word153"#155
incorrect#"word154"#156
incorrect#"word155"#157
incorrect#"word156"#158
incorrect#"word157"#159
incorrect#"word158"#160
incorrect#"word159"#161
incorrect#"word160"#162
incorrect#"word161"#163
incorrect#"word162"#164
incorrect#"word163"#165
incorrect#"word164"#166
incorrect#"word165"#167
incorrect#"word166"#168
incorrect#"word167"#169
incorrect#"word168"#170
incorrect#"word169"#171
incorrect#"word170"#172
incorrect#"word171"#173
incorrect#"word172"#174
incorrect#"word173"#175
incorrect#"word174"#176
incorrect#"word175"#177
incorrect#"word176"#178
incorrect#"word177"#179
incorrect#"word178"#180
incorrect#"word179"#181
incorrect#"word180"#182
incorrect#"word181"#183
incorrect#"word182"#184
incorrect#"word183"#185
incorrect#"word184"#186
incorrect#"word185"#187
incorrect#"word186"#188
incorrect#"word187"#189
incorrect#"word188"#190
incorrect#"word189"#191
incorrect#"word190"#192
incorrect#"word191"#193
incorrect#"word192"#194
incorrect#"word193"#195
incorrect#"word194"#196
incorrect#"word195"#197
incorrect#"word196"#198
incorrect#"word197"#199
incorrect#"word198"#200
incorrect#"word199"#201
incorrect#"word200"#202
incorrect#"word201"#203
incorrect#"word202"#204
incorrect#"word203"#205
incorrect#"word204"#206
incorrect#"word205"#207
incorrect#"word206"#208
incorrect#"word207"#209
incorrect#"word208"#210
incorrect#"word209"#211
incorrect#"word210"#212
incorrect#"word211"#213
incorrect#"word212"#214
incorrect#"word213"#215
incorrect#"word214"#216
incorrect#"word215"#217
incorrect#"word216"#218
incorrect#"word217"#219
incorrect#"word218"#220
incorrect#"word219"#221
incorrect#"word220"#222
incorrect#"word221"#223
incorrect#"word222"#224
incorrect#"word223"#225
incorrect#"word224"#226
incorrect#"word225"#227
incorrect#"word226"#228
incorrect#"word227"#229
incorrect#"word228"#230
incorrect#"word229"#231
incorrect#"word230"#232
incorrect#"word231"#233
incorrect#"word232"#234
incorrect#"word233"#235
incorrect#"word234"#236
incorrect#"word235"#237
incorrect#"word236"#238
incorrect#"word237"#239
incorrect#"word238"#240
incorrect#"word239"#241
incorrect#"word240"#242
incorrect#"word241"#243
incorrect#"word242"#244
incorrect#"word243"#245
incorrect#"word244"#246
incorrect#"word245"#247
incorrect#"word246"#248
incorrect#"word247"#249
incorrect#"word248"#250
incorrect#"word249"#251
incorrect#"word250"#252
incorrect#"word251"#253
incorrect#"word252"#254
incorrect#"word253"#255
incorrect#"word254"#256
incorrect#"word255"#257
incorrect#"word256"#258
incorrect#"word257"#259
incorrect#"word258"#260
incorrect#"word259"#261
incorrect#"word260"#262
incorrect#"word261"#263
incorrect#"word262"#264
incorrect#"word263"#265
incorrect#"word264"#266
incorrect#"word265"#267
incorrect#"word266"#268
incorrect#"word267"#269
incorrect#"word268"#270
incorrect#"word269"#271
incorrect#"word270"#272
incorrect#"word271"#273
incorrect#"word272"#274
incorrect#"word273"#275
incorrect#"word274"#276
incorrect#"word275"#277
incorrect#"word276"#278
incorrect#"word277"#279
incorrect#"word278"#280
incorrect#"word279"#281
incorrect#"word280"#282
incorrect#"word281"#283
incorrect#"word282"#284
incorrect#"word283"#285
incorrect#"word284"#286
incorrect#"word285"#287
incorrect#"word286"#288
incorrect#"word287"#289
incorrect#"word288"#290
incorrect#"word289"#291
incorrect#"word290"#292
incorrect#"word291"#293
incorrect#"word292"#294
incorrect#"word293"#295
294#"word294"#296
295#"word295"#297
296#"word296"#298
297#"word297"#299
298#"word298"#300
299#"word299"#301
300#"word300"#302
301#"word301"#303
302#"word302"#304
303#"word303"#305
304#"word304"#306
305#"word305"#307
306#"word306"#308
307#"word307"#309
308#"word308"#310
309#"word309"#311
310#"word310"#312
311#"word311"#313
312#"word312"#314
313#"word313"#315
314#"word314"#316
315#"word315"#317
316#"word316"#318
317#"word317"#319
318#"word318"#320
319#"word319"#321
320#"word320"#322
321#"word321"#323
322#"word322"#324
323#"word323"#325
324#"word324"#326
325#"word325"#327
326#"word326"#328
327#"word327"#329
328#"word328"#330
329#"word329"#331
330#"word330"#332
331#"word331"#333
332#"word332"#334
333#"word333"#335
334#"word334"#336
335#"word335"#337
336#"word336"#338
337#"word337"#339
338#"word338"#340
339#"word339"#341
340#"word340"#342
341#"word341"#343
342#"word342"#344
343#"word343"#345
344#"word344"#346
345#"word345"#347
346#"word346"#348
347#"word347"#349
348#"word348"#350
349#"word349"#351
350#"word350"#352
351#"word351"#353
352#"word352"#354
353#"word353"#355
354#"word354"#356
355#"word355"#357
356#"word356"#358
357#"word357"#359
358#"word358"#360
359#"word359"#361
360#"word360"#362
361#"word361"#363
362#"word362"#364
363#"word363"#365
364#"word364"#366
365#"word365"#367
366#"word366"#368
367#"word367"#369
368#"word368"#370
369#"word369"#371
370#"word370"#372
371#"word371"#373
372#"word372"#374
373#"word373"#375
374#"word374"#376
375#"word375"#377
376#"word376"#378
377#"word377"#379
378#"word378"#380
379#"word379"#381
380#"word380"#382
381#"word381"#383
382#"word382"#384
383#"word383"#385
384#"word384"#386
385#"word385"#387
386#"word386"#388
387#"word387"#389
388#"word388"#390
389#"word389"#391
390#"word390"#392
391#"word391"#393
392#"word392"#394
393#"word393"#395
394#"word394"#396
395#"word395"#397
396#"word396"#398
397#"word397"#399
398#"word398"#400
399#"word399"#401
400#"word400"#402
401#"word401"#403
402#"word402"#404
403#"word403"#405
404#"word404"#406
405#"word405"#407
406#"word406"#408
407#"word407"#409
408#"word408"#410
409#"word409"#411
410#"word410"#412
411#"word411"#413
412#"word412"#414
413#"word413"#415
414#"word414"#416
415#"word415"#417
416#"word416"#418
417#"word417"#419
418#"word418"#420
419#"word419"#421
420#"word420"#422
421#"word421"#423
422#"word422"#424
423#"word423"#425
424#"word424"#426
425#"word425"#427
426#"word426"#428
427#"word427"#429
428#"word428"#430
429#"word429"#431
430#"word430"#432
431#"word431"#433
432#"word432"#434
433#"word433"#435
434#"word434"#436
435#"word435"#437
436#"word436"#438
437#"word437"#439
438#"word438"#440
439#"word439"#441
440#"word440"#442
441#"word441"#443
442#"word442"#444
443#"word443"#445
444#"word444"#446
445#"word445"#447
446#"word446"#448
447#"word447"#449
448#"word448"#450
449#"word449"#451
450#"word450"#452
451#"word451"#453
452#"word452"#454
453#"word453"#455
454#"word454"#456
455#"word455"#457
456#"word456"#458
457#"word457"#459
458#"word458"#460
459#"word459"#461
460#"word460"#462
461#"word461"#463
462#"word462"#464
463#"word463"#465
464#"word464"#466
465#"word465"#467
466#"word466"#468
467#"word467"#469
468#"word468"#470
469#"word469"#471
470#"word470"#472
471#"word471"#473
472#"word472"#474
473#"word473"#475
474#"word474"#476
475#"word475"#477
476#"word476"#478
477#"word477"#479
478#"word478"#480
479#"word479"#481
480#"word480"#482
481#"word481"#483
482#"word482"#484
483#"word483"#485
484#"word484"#486
485#"word485"#487
486#"word486"#488
487#"word487"#489
488#"word488"#490
489#"word489"#491
490#"word490"#492
491#"word491"#493
492#"word492"#494
493#"word493"#495
494#"word494"#496
495#"word495"#497
496#"word496"#498
497#"word497"#499
498#"word498"#500
499#"word499"#501
500#"word500"#502
501#"word501"#503
502#"word502"#504
503#"word503"#505
504#"word504"#506
505#"word505"#507
506#"word506"#508
507#"word507"#509
508#"word508"#510
509#"word509"#511
510#"word510"#512
511#"word511"#513
512#"word512"#514
513#"word513"#515
514#"word514"#516
515#"word515"#517
516#"word516"#518
517#"word517"#519
518#"word518"#520
519#"word519"#521
520#"word520"#522
521#"word521"#523
522#"word522"#524
523#"word523"#525
524#"word524"#526
525#"word525"#527
526#"word526"#528
527#"word527"#529
528#"word528"#530
529#"word529"#531
530#"word530"#532
531#"word531"#533
532#"word532"#534
533#"word533"#535
534#"word534"#536
535#"word535"#537
536#"word536"#538
537#"word537"#539
538#"word538"#540
539#"word539"#541
540#"word540"#542
541#"word541"#543
542#"word542"#544
543#"word543"#545
544#"word544"#546
545#"word545"#547
546#"word546"#548
547#"word547"#549
548#"word548"#550
549#"word549"#551
550#"word550"#552
551#"word551"#553
552#"word552"#554
553#"word553"#555
554#"word554"#556
555#"word555"#557
556#"word556"#558
557#"word557"#559
558#"word558"#560
559#"word559"#561
560#"word560"#562
561#"word561"#563
562#"word562"#564
563#"word563"#565
564#"word564"#566
565#"word565"#567
566#"word566"#568
567#"word567"#569
568#"word568"#570
569#"word569"#571
570#"word570"#572
571#"word571"#573
572#"word572"#574
573#"word573"#575
574#"word574"#576
575#"word575"#577
576#"word576"#578
577#"word577"#579
578#"word578"#580
579#"word579"#581
580#"word580"#582
581#"word581"#583
582#"word582"#584
583#"word583"#585
584#"word584"#586
585#"word585"#587
586#"word586"#588
587#"word587"#589
588#"word588"#590
589#"word589"#591
590#"word590"#592
591#"word591"#593
592#"word592"#594
593#"word593"#595
594#"word594"#596
595#"word595"#597
596#"word596"#598
597#"word597"#599
598#"word598"#600
599#"word599"#601
600#"word600"#602
601#"word601"#603
602#"word602"#604
603#"word603"#605
604#"word604"#606
605#"word605"#607
606#"word606"#608
607#"word607"#609
608#"word608"#610
609#"word609"#611
610#"word610"#612
611#"word611"#613
612#"word612"#614
613#"word613"#615
614#"word614"#616
615#"word615"#617
616#"word616"#618
617#"word617"#619
618#"word618"#620
619#"word619"#621
620#"word620"#622
621#"word621"#623
622#"word622"#624
623#"word623"#625
624#"word624"#626
625#"word625"#627
626#"word626"#628
627#"word627"#629
628#"word628"#630
629#"word629"#631
630#"word630"#632
631#"word631"#633
632#"word632"#634
633#"word633"#635
634#"word634"#636
635#"word635"#637
636#"word636"#638
637#"word637"#639
638#"word638"#640
639#"word639"#641
640#"word640"#642
641#"word641"#643
642#"word642"#644
643#"word643"#645
644#"word644"#646
645#"word645"#647
646#"word646"#648
647#"word647"#649
648#"word648"#650
649#"word649"#651
650#"word650"#652
651#"word651"#653
652#"word652"#654
653#"word653"#655
654#"word654"#656
655#"word655"#657
656#"word656"#658
657#"word657"#659
658#"word658"#660
659#"word659"#661
660#"word660"#662
661#"word661"#663
662#"word662"#664
663#"word663"#665
664#"word664"#666
665#"word665"#667
666#"word666"#668
667#"word667"#669
668#"word668"#670
incorrect#"word669"#671
incorrect#"word670"#672
incorrect#"word671"#673
incorrect#"word672"#674
incorrect#"word673"#675
incorrect#"word674"#676
incorrect#"word675"#677
incorrect#"word676"#678
incorrect#"word677"#679
incorrect#"word678"#680
incorrect#"word679"#681
incorrect#"word680"#682
incorrect#"word681"#683
incorrect#"word682"#684
incorrect#"word683"#685
incorrect#"word684"#686
incorrect#"word685"#687
incorrect#"word686"#688
incorrect#"word687"#689
incorrect#"word688"#690
incorrect#"word689"#691
incorrect#"word690"#692
incorrect#"word691"#693
incorrect#"word692"#694
incorrect#"word693"#695
incorrect#"word694"#696
incorrect#"word695"#697
incorrect#"word696"#698
incorrect#"word697"#699
incorrect#"word698"#700
incorrect#"word699"#701
incorrect#"word700"#702
incorrect#"word701"#703
incorrect#"word702"#704
incorrect#"word703"#705
incorrect#"word704"#706
incorrect#"word705"#707
incorrect#"word706"#708
incorrect#"word707"#709
incorrect#"word708"#710
incorrect#"word709"#711
incorrect#"word710"#712
incorrect#"word711"#713
incorrect#"word712"#714
incorrect#"word713"#715
incorrect#"word714"#716
incorrect#"word715"#717
incorrect#"word716"#718
incorrect#"word717"#719
incorrect#"word718"#720
incorrect#"word719"#721
incorrect#"word720"#722
incorrect#"word721"#723
incorrect#"word722"#724
incorrect#"word723"#725
incorrect#"word724"#726
incorrect#"word725"#727
incorrect#"word726"#728
727#"word727"#729
728#"word728"#730
729#"word729"#731
730#"word730"#732
731#"word731"#733
732#"word732"#734
733#"word733"#735
734#"word734"#736
735#"word735"#737
736#"word736"#738
737#"word737"#739
738#"word738"#740
739#"word739"#741
740#"word740"#742
741#"word741"#743
742#"word742"#744
743#"word743"#745
744#"word744"#746
Example of connecting unit and class
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Etl;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
DataUserProvider: IEtlPlainDataUserProvider;
UserProvider: IDtUserProviderEx;
Begin
// Get repository
MB := Params.Metabase;
// Get ETL task
MObj := MB.ItemById["ETLT"].Edit();
EtlTask := MObj As IEtlTask;
//Create the User Source object
DataUserProvider := EtlTask.Create(EtlObjectType.eotPlainDataUserProvider) As IEtlPlainDataUserProvider;
DataUserProvider := DataUserProvider.Edit() As IEtlPlainDataUserProvider;
// Set ExMode
DataUserProvider.ExMode := True;
// Set source name
DataUserProvider.Name := User source;
// Connect unit and class for user source
UserProvider := DataUserProvider.Provider As IDtUserProviderEx;
UserProvider.Metabase := Params.Metabase;
UserProvider.ImplClass := "FORMUSERPROVNET.MyUserProvider";
DataUserProvider.Save();
// Visual presentation of source in task
CreateWXP(DataUserProvider, EtlTask);
// Save changes
Mobj.Save();
End Sub;
{ Create a visual object of data source }
Public Shared Sub CreateWXP(CopyObj: IEtlPlainDataProvider; Etltask: IEtltask);
Var
WxDataTrans: IWxRectangle;
WxETLDataTrans: WxEtlObject = New WxEtlObjectClass();
OutPoint: GxPointF = New GxPointFClass();
Begin
WxDataTrans := EtlTask.Workspace.CreateRectangle();
WxDataTrans.Id := CopyObj.Id;
WxETLDataTrans.EtlObject := CopyObj;
WxDataTrans.Style.TextPosition := WxTextPosition.wtpBottom;
WxDataTrans.Style.PictureMarginTop := -10;
OutPoint := WxDataTrans.PinPosition;
OutPoint.Create(20, 20);
WxDataTrans.Extension := WxETLDataTrans As IWxShapeExtension;
End Sub CreateWXP;
After executing the example a source object is created in the specified ETL task. A new page named CrPage is created in the source edit wizard. On moving to the page the TextBox1 component displays the current model XML data.
On the CrPage page on the button click:
The TextBox1 component displays changed XML data.
The IEtlUserDataContainer.SetDirty property is set to True, that is, confirmation window opens on closing edit wizard window if there are not changes made.
See also: