Re: Building array from list

2010-11-01 Thread Ken Ray
If you want to factor the code out so it's more reusable but a bit more code, you could do this: repeat for each line tLine in fld 1 appendArray tDataA,(item 2 of tLine),(item 1 of tLine) end repeat command appendArray @pArray,pKey,pValue if pArray[pKey] is empty then put pValue into pArr

Re: Building array from list

2010-11-01 Thread william humphrey
Thanks. I will experiment with both. I knew there had to be a simple way. It's funny how so many coding solutions require lots of experience before you can look at the solution without getting a headache. ___ use-revolution mailing list use-revolution@lis

Re: Building array from list

2010-11-01 Thread Mike Bonner
Oh, might want to set the array to empty prior to the repeat so you avoid duplicates if you run the conversion more than once. On 11/1/10, Mike Bonner wrote: > Can also do it as follows: > >repeat for each line tLine in field 1 > put the number of items in tdataA[(item 2 of tLine)] + 1

Re: Building array from list

2010-11-01 Thread Mike Bonner
Can also do it as follows: repeat for each line tLine in field 1 put the number of items in tdataA[(item 2 of tLine)] + 1 into tItemNum put item 1 of tLine into item tItemNum of tDataA[(item 2 of tLine)] end repeat Can most likely combine the 2 lines of the repeat into a 1 liner

Re: Building array from list

2010-11-01 Thread Gregory Lypny
Hello William, This will give you an array with four keys corresponding to [1] fruit, [2] dances, [3] colours, and [4] animals. repeat for each line thisLine in theList put the first item of thisLine & comma after myArray[the second item of thisLine] end repeat The contents of each has a trail

Building array from list

2010-11-01 Thread william humphrey
I was wondering. If you have a list: apple,1 orange,1 grapefruit,1 tango,2 blue,3 green,3 yellow,3 zebra,9 And you want to convert it into an array: (apple,orange,grapefruit[1]) (tango[2]) (blue,green,yellow[3]) (zebra,[9]) What would be the easiest way. I'm always a little confused by arrays b