It's not a list! It's an array.

It's not THE NUMBER OF LINES in myArray.
it's the number of lines in the KEYS of myArray. Big difference.
I'll build a silly array here:

set the itemdelimiter to comma
put "Jefferson,Washington,Lincoln,Bush,Elvis" into historyList
repeat with n = 1 to number  of items in historyList
  put item n of historyList into myArray[n]
end repeat

Same as :
1)  put the keys of myarray into tKeys
2)   put number of lines in temp into tArrayLines

Once again, you can't directly put an array into a field to "see" the elements. It needs to be 'disassembled', element by element This is expected behavior. You make a list by rotating through each key, either
manually

put myArray [1] & return into toadMeatList
put myArray [2] & return after toadMeatList
put myArray [5]  after toadMeatList

RESULTS-->
1<tab>Jefferson
2<tab> Washington
5<tab> Elvis

or in a "regular" loop

put "1,2,5" into orderList
repeat with n = 1 to numLines
  put myArray[n] & return after toadMeatList
end repeat

RESULTS-->
1<tab>Jefferson
2<tab> Washington
5<tab> Elvis


or using combine

combine myArray with return & tab

RESULTS-->
1<tab>Jefferson
2<tab>Washington
3<tab>Lincoln
4<tab>Bush
5<tab>Elvis

From: "william humphrey" <[EMAIL PROTECTED]>
To: "How to use Revolution" <use-revolution@lists.runrev.com>
Subject: Re: returning result from a function when the number of items in
        the result varies

Thanks again. I'm still curious about the array. When I use the "number of
lines in myArray" I get the correct answer "1" before I send it out of the
function as "myArray" but when I do the same "number of lines in myArray"
after it is called then the answer is "0".
If I ask for one key in the array (as myArray[1] ) and return that it works
as expected. I understand that the contents of the array are invisible until
I ask for one of the keys. But it still wasn't working as expected. I think
Jim's suggestion might be better as the list of data elements can be handed
back and it will work as I expect.

It was fun to play with the array and I'm surprised that it doesn't return
in the function like a list would as in my mind I think of the array as a list.

--


stephen barncard
s a n  f r a n c i s c o
- - -  - - - - - - - - -


_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to