Sub Arrays using keys

Glen Bojsza gbojsza at mac.com
Tue Mar 30 15:26:41 EST 2004


I was wondering if it is possible to create separate sub arrays based 
on the keys of the parent array?

One thing to watch for is that the data in the field columns may not be 
unique and so this eliminates them from being used with the split 
command.

--snip--

put fld "bigData" into tsarray
put 1 into z
   put 1 into b

   repeat for each line j in mycagg -- determines the columns of the 
field to build the parent array

     put line z of myaggvar into aname -- determines the name of the 
keys for each sub array

     repeat for each line L in tsarray descending
       put item (word 1 of j) of L & cr after aname[b,z]  -- builds 2D 
array
       put b + 1 into b
     end repeat
     put z + 1 into z
   end repeat


or should the line for the 2D array be

put item (word 1 of j) of L & cr after myArray[aname]

The overall idea is to :

1. create individual arrays from a large data field
2. determine the start and ending row number in a time array based on a 
user selected range
3. gather the data from the range of rows from the other sub arrays and 
manipulate

Of course all the arrays will be identical in length.






More information about the use-livecode mailing list