Array Coolness

Bob Sneidar bobs at twft.com
Mon Mar 2 17:14:07 EST 2009


Indded it probably is, but I am actually doing something a little more  
complicated. I am going to create 2 new arrays, one for the visible  
columns and one for the invisible columns, and based upon a custom  
property for each form field in my form, I will append the column to  
either array, then append the hidden array to the visible array.

The repeat loops and conditional branching in such an endeavor make my  
head hurt to think of it! OUCH! So I am going with the "easy code"  
philosophy on this one.

Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM

On Mar 2, 2009, at 1:51 PM, Alex Tweedly wrote:

>> theColumns is a tab delimited list of the SQL column names, and
>> theData is a tab delimited list of the SQL data. After running this
>> script, lo and behold, what was the first column in the array is now
>> the last! THAT IS AWESOME! Great job Runtime Revolution!
>>
> Indeed it is awesome. I too love arrays.
> But as a dedicated benchmarker, I'd have to point out that the more  
> simple
>
>    set the itemdelimiter to Tab
>    put item 2 to -1 of theColumns & the itemdelimiter & item 1 of
> theColumns &cr into theTableData
>    repeat for each line L in theData
>        put item 2 to -1 of L & the itemdelimiter & item 1 of L &cr
> after theTableData
>    end repeat
>
> will do the same thing, but roughly 40% faster (YMMV, since it is very
> data dependent).
>
>
> -- Alex.





More information about the use-livecode mailing list