Hi all. I just wrote an alternate form of printKeys which some may find useful.
Normally printKeys returns data in this form:
1
conferencename:
amount: 0
enddate: 2012-01-15
conferenceid: 0
siteid: 2
baseunit: day
uniqueid: 8
clientid: 0
starttime: 4:00 PM
baseprice: 0
building: Harmony
clientname:
discount: 0
roomid: 49
rnotes:
startdate: 2012-01-12
endtime: 10:00 AM
roomnumber: 403
reservationid: 1
quantity: 1
This makes it fairly impossible to use the filter command for records based
upon certain values being present. My function returns the values in this form:
[1] ["conferencename"] ,[1] ["amount"] 0,[1] ["enddate"]
2012-01-15,[1] ["conferenceid"] 0,[1] ["siteid"] 2,[1]
["baseunit"] day,[1] ["uniqueid"] 8,[1] ["clientid"] 0,[1]
["starttime"] 4:00 PM,[1] ["baseprice"] 0,[1] ["building"]
Harmony,[1] ["clientname"] ,[1] ["discount"] 0,[1] ["roomid"]
49,[1] ["rnotes"] ,[1] ["startdate"] 2012-01-12,[1] ["endtime"]
10:00 AM,[1] ["roomnumber"] 403,[1] ["reservationid"] 1,[1]
["quantity"] 1
The beauty of this is if I had a lot of lines and only wanted data that had
"2012-" in the line I could:
filter theText with "*" & tab & "2012-" & "*" -- the tab is the value delimiter
I can then convert the text back into an array using another function, and
voila! A subset of the original array! If anyone is interested in this let me
know, otherwise I won't waste bandwidth on it. It is mainly useful for doing
filtering on datagrid data. Sure I could do the same thing with the dgText, but
as I have mentioned before, I have columns of data that do not display in the
datagrid, and dgText only returns the visible columns of text. I need to
preserve the array structure.
Bob
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode