Have a separate list, or a special key that holds your list of keys. put empty into tArray repeat for each line tLine in tData put item 2 of tLine into tKey if tKey = EMPTY then next repeat put tLine & CR after tArray[tKey] put tKey & cr after tarray['myKeyList'] end repeat
Then when you need to pull things back out, grab myKeyList and iterated through it. (delete the trailing cr after the repeat ends of course) On Sat, Aug 19, 2017 at 6:28 AM, Klaus major-k via use-livecode < [email protected]> wrote: > Hi Jonathan, > > > Am 19.08.2017 um 14:22 schrieb Jonathan Lynch via use-livecode < > [email protected]>: > > > > You could alter the name of the elements... > > > > Put "X_" & tK into tArrayElement > > Put tData into myArray[tArrayElement] > > X would be created in a counting loop. > > > > That way, when you get the keys of the array, you can sort numeric by > item 1 of each, using "_" as the itemdel. This will give you the original > order with just 1 array dimension, and you can easily retrieve the value of > tK. > > not possible, I am doing something like this: > ... > put empty into tArray > repeat for each line tLine in tData > put item 2 of tLine into tKey > if tKey = EMPTY then next repeat > put tLine & CR after tArray[tKey] > end repeat > ... > And item 2 are these said number, so I cannot control/name the key this > way. > > > Sent from my iPhone > > > >> On Aug 19, 2017, at 8:12 AM, jbv via use-livecode < > [email protected]> wrote: > >> > >> Hi Klaus > >> I've been there and the only solution I found was to maintain > >> a second array : > >> > >> put 0 into x > >> put "abc" into array1[60] > >> add 1 to x > >> put 60 into array2[x] > >> put "xyz" into array1[30] > >> add 1 to x > >> put 30 into array2[x] > >> > >> put the keys of array2 into tkeys > >> sort lines of tkeys ascending numeric > >> repeat for each line j in tkeys > >> put array1[array2[j]] & return after myvar > >> end repeat > > Best > > Klaus > > -- > Klaus Major > http://www.major-k.de > [email protected] > > > _______________________________________________ > 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 > _______________________________________________ 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
