Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.ini limitation...
Well, I think I just stumbled across one of those limitations G. spoke of when using .ini files to do a rset/rget!

Heres and example for how the .ini file would look:
7/28/2008 12:49:31 PM=Data1|Data2|Data3|Data4|Data5|
7/28/2008 12:50:31 PM=Data1|Data2|Data3|Data4|Data5|
7/28/2008 12:51:31 PM=Data1|Data2|Data3|Data4|Data5|

Now how do I grab the variable with rget when I can't be sure exactly what it is? I was really hoping it would be simple like using:
rget Data * "Payments" FileName
But it's not.

Well...back to more coffee and programming. Thanks in advance for any help with this!
Jimmy Vig
using xml it could be

Copy      Help
;this macro shows how to write XML file that looks like

;,<date>7/28/2008 12:49:31 PM</date>
;,<!-- and here you can add more tags, for example use different tags for Data1, Data2, etc -->
;,<!-- unlike in HTML, tag names are not predefined. You define them. But use only alphanumeric characters, _ and -. -->
;,<date>7/28/2008 12:50:31 PM</date>
;,<date>7/28/2008 12:51:31 PM</date>

str xmlfile="$desktop$\pa.xml"
if(!dir(xmlfile)) _s="<payments />"; _s.setfile(xmlfile)

IXml xml=CreateXml
xml.FromFile(xmlfile) ;;load existing file, because this macro is going to append, not replace
IXmlNode re=xml.RootElement ;;payments
IXmlNode ni

ni.Add("date" "7/28/2008 12:49:31 PM")
ni.Add("x" "Data1|Data2|Data3|Data4|Data5|")

ni.Add("date" "7/28/2008 12:50:31 PM")
ni.Add("x" "Data1|Data2|Data3|Data4|Data5|")

ni.Add("date" "7/28/2008 12:51:31 PM")
ni.Add("x" "Data1|Data2|Data3|Data4|Data5|")

;note: you can save (call ToFile) multiple times, not necessary only at the end
;note: QM also will have an autosave option, plus some more

Copy      Help
;this macro shows how to get data from the XML file

str xmlfile="$desktop$\pa.xml"
if(!dir(xmlfile)) ret

IXml xml=CreateXml
ARRAY(IXmlNode) a
xml.Path("payments/i" a) ;;populates array a with all i tags
int i
for i 0 a.len
,IXmlNode& n=a[i]
,str s1=n.ChildValue("date")
,str s2=n.ChildValue("x")
,out s1
,out s2
,out "------"
Holy cow! I am going to have so much fun with that! I feel like the whole world has opened up to me! Well...until I need to do something new!
So much better than .ini files! So Much Better!

Thank you so much for your help as always!

Forum Jump:

Users browsing this thread: 1 Guest(s)