Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
User Defined Function Structure
#3
Thanks Gintaras, I looked at sel case and IStringMap interfaces as well as re-examined xml.

I see the advantage of using Xml. I can create dialogs to ease entry of the users database and even have the user populate the information themselves by a user friendly document which will create the user child elements and its attributes.

Function Function8
Code:
Copy      Help
out
IXml MyUsersXml=CreateXml

IXmlNode MyUsers=MyUsersXml.Add("Users") ;;add root element (XML must have exactly 1 root element)

IXmlNode IndivUserData=MyUsers.Add("jkj1")
IndivUserData.SetAttribute("LoginName" "jkj1") ;;add attribute
IndivUserData.SetAttribute("LastName" "Jones") ;;add another attribute
IndivUserData.SetAttribute("Full Name" "Jonathan K Jones") ;;add another attribute
;
IndivUserData=MyUsers.Add("sjs1")
;
IndivUserData.SetAttribute("LoginName" "sjs1") ;;add attribute
IndivUserData.SetAttribute("LastName" "Smith") ;;add another attribute
IndivUserData.SetAttribute("Full Name" "Sam J Smith") ;;add another attribute
;
IndivUserData=MyUsers.Add("wje1")
;
IndivUserData.SetAttribute("LoginName" "wje1") ;;add attribute
IndivUserData.SetAttribute("LastName" "Edwards") ;;add another attribute
IndivUserData.SetAttribute("Full Name" "William J Edwards") ;;add another attribute


;;
MyUsersXml.ToFile("$qm$\MyUsers.xml")
;

out "-----"
str s
MyUsersXml.ToString(s) ;;compose xml string
out s
This creates this Xml structure

Quote:-----
<Users>
<jkj1 LoginName="jkj1" LastName="Jones" Full Name="Jonathan K Jones" />
<sjs1 LoginName="sjs1" LastName="Smith" Full Name="Sam J Smith" />
<wje1 LoginName="wje1" LastName="Edwards" Full Name="William J Edwards" />
</Users>


My question now is about speed. The user defined functions are accessed multiple times over and over. It would seem to be slow if QM had to access either a local or network file each time to get the various elements. Is it possible to populate a user defined function like I originally queried about but instead of it already being in the qml file, it gets populated from an Xml file only at the time of QM startup or loading/updating of a specific qml file?


Thanks!!!!

Stuart


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)