Array, Array, who has got the array?
Mark Brownell
gizmotron at earthlink.net
Mon Mar 1 01:24:59 EST 2004
On Sunday, February 29, 2004, at 09:19 PM, hershrev wrote:
> Hello,
> And if I'd like to use an array as a table field getting a SQL into an
> array ?I'll try to be a bit more specific .
> In a table field if you get a sql
> company first_name last_name
> line 1 run rev john smith
> line 2 hersh rev
> ok, what happened over here is that on the second line the company
> column is empty but the first name (hersh) is still the second item.
> And then I'd like to , with a repeat to put item by item into fields.
> Thanks.
I've been working on naming conventions for a simple XML construct
where the names are directly relational to row/column coordinates.
Extraction of a specific row/column could be by pull parser. Since
there is only one data chunk that exists in the entire simple XML
document my advice is to use a pull parser. There are different ways to
get your data if you want to. I prefer the direct approach.
Example: <r1c1>your data here</r1c1> where r = row and c = column.
So like the simple XML your array keys can be r1c1 for company, r1c2
for first_name, and r1c3 for last_name. You can then add new lines by
using keys that are r2c1, r2c2, and r2c3.
So you could use an assembly scheme to create proper keys to extract
data from your array.
Example:
put 1 into rowX
put 1 into columnX
put "r" & rowX & "c" & columnX into thisKey
put myArray[thisKey] into line1Company
...or you could create pull parser tags sets like:
"<" & thisKey & ">" and "</" & thisKey & ">"
I have commented on pull parsers in past topics. See PNLP in the list
archives. I mentioned the simple XML here because tag set schema and
array keys work well together. In a way they both point to containers.
I use my own pull parsers because sometimes my data is multi-lined
HTMLText. This would not work well with most XML parsers.
Mark
More information about the use-livecode
mailing list