Thanks Agnes
I was hoping to avoid creating the array ouside of the function if possible.
This is because I like my functions to be fully encapsulated so I dont have to go and look at them and because it becomes more awkward when having to use them on an entire record set.
I guess I will end up passing the list as a single string and parsing it into an array in the function. That give me the encapsulation I want but next time I use it I will probably send the wrong type of parameter..sigh
Your use of ALINES is much nicer they must have changed the command between ver 6 and 7
Thanks for the tip:)
>Hi Mark,
>the most readable thing is
>
>dimension laArray(3,1)
>laArray(1,1 = ...
>...
>
>MyFunc(@laArray)
>
>the next (but only for strings)
>
>dimension laArray(3,1)
>ALINES(laArray,'String1,String2,String3',.f.,',')
>MyFunc(@laArray)
>
>
>Don't miss EXTERNAL ARRAY in your Procedure!
>
>HTH
>Agnes
>>I want to pass a series of parameters to a function but have them arrive in the function as an array.
>>
>>So far there are 2 ways I can think of doing this but I am hoping there is a more obvious way that I am missing.
>>
>>eg
>>
>>
>>
>>? myfunc('apple','orange','pear')
>>
>>
>>func myfunc
>>lparam myarray
>>? myarray(1)
>>? myarray(2)
>>? myarray(3)
>>return
>>
>>
>>
>>Here are the ways I am considering using
>>
>>1. Create the array first and send it by reference :( not pretty
>>
>>2. send a single string myfunc('apple,orange,pear') and then parse the string into an array.
>>
>>this is a great little function for parsing a comma deliminated string into an array
>>* nRows = ALINES(myarray, STRTRAN(cTest,",",CHR(13)))
>>
>>
>>Can someone put my mind at rest, whats the obvious thing I am missing?