what form of "split" turns a tab-delimited variable into an array with the first line as keys?
Jim Ault
jimaultwins at yahoo.com
Fri Apr 9 14:09:20 EDT 2010
On Apr 9, 2010, at 8:13 AM, Bob Sneidar wrote:
> Just had a few rounds with split and combine, and they are not what
> you think they are. Split takes the first value in a delimited line
> and that becomes the key. The rest of the items become the elements.
> The commands are fairly useless for much of anything.
>
> Bob
>
I use split and combine often for routine processing of large data sets.
I operate several high-speed networks using the power of spit/combine.
Remember, in their simple form, they are associative arrays, not
indexed arrays.
Using a few techniques, they become a good way to store very complex
and multi-dimensional data sets.
For cross-tabulation or table translation it is fairly easy to setup
up a couple temporary arrays to quickly make the tasks happen. You
need to remember that associative arrays use strings as keys and
duplicate keys result in replacement. For example, translating a
table could result in the new keys being duplicate strings, thus some
of the data would get lost (overwritten). It is easy to avoid this.
Also look at Intersect and Union in the docs for ways of filtering
arrays without the filter command.
Build a temp array with desired keys, then intersect to keep the
qualifiers.
At some point, it is better to use a database, such as sql-type or
Valentina.
For me, I enjoy the speed and ease-of-use, realizing that these arrays
are not the same as indexed arrays (thus are not as powerful for
mathematics, etc)
Jim Ault
Las Vegas
More information about the use-livecode
mailing list