At 7:00 PM -0400 7/17/01, Troy Rollins wrote:
>put the keys of myArray into listOfKeys
>  repeat with x = 1 to the number of lines in listOfKeys
>    put item(4) of (line x of listOfKeys) & Tab into line x of me
>    put item(1) of (line x of listOfKeys) & Tab after line x of me
>    put item(3) of (line x of listOfKeys) & Tab after line x of me
>    put item(2) of (line x of listOfKeys) & Tab after line x of me
>  end repeat

The problem is that the keys of myArray does not return the values stored in myArray; 
instead it returns a list of the keys. If myArray is:

myArray["key1"] = "first value"
myArray["key2"] = "second value"
myArray["key3"] = "third value"

Then the keys of myArray will return:

key1
key2
key3

I think you want something more like:

  put empty into arrayText
  put the keys of myArray into listOfKeys
  repeat for each line aKey in listOfKeys
    put myArray[aKey] into anElement
    replace comma with tab in anElement
    put anElement & cr after arrayText
  end repeat
  delete the last char of arrayText
  put arrayText into fld "display"

Note that this assumes that you store the items in the order you want to display them, 
and that none of them already have tabs in them.

Finally (I think I need to drink more decaf today) bear in mind that this task is 
about to get much easier. New abilities coming in the next version will allow you to 
use:

--not available in current version
  put empty into arrayText
  repeat for each element anElement in myArray
    replace comma with tab in anElement
    put anElement & cr after arrayText
  end repeat
  delete the last char of arrayText
  put arrayText into fld "display"

to get the values directly.

Or even --this one's the easiest, and certainly the fastest

--not available in current version
put myArray into workArray
combine workArray using cr
replace comma with tab in workArray
put workArray into fld "display"

regards,

gc
-- 

Reply via email to