>Is there a way that one can retrieve a PARAMETER's name and value via a parameter #?
>
>ie:
>
>FUNCTION TestFunct
>LPARAMETERS m.lcParm1, m.lcParm2
>
>** How do I say, give me the name and value of the 2nd parameter without having to specify m.lcParm2? This would be similar to the arg function in other languages.
>
>RETURN( m.llValue )
The foll is an extract from the example taken from the vfp help file for PCOUNT()
FUNCTION getavg
PARAMETERS gnPara1,gnPara2,gnPara3,gnPara4,gnPara5, ;
gnPara6,gnPara7,gnPara8,gnPara9
IF PCOUNT( ) = 0
RETURN 0
ENDIF
gnResult = 0
FOR gnCount = 1 to PARAMETERS( )
gcCompare = 'gnPara' +(STR(gnCount,1))
gnResult = gnResult + EVAL(gcCompare)
ENDFOR
gnResult = gnResult / (gnCount - 1)
RETURN gnResult
Maybe something like this will help?
.OR.
Pass the parameters as an array and then get the values from the array:
DIME a_temp(10)
a_temp(1) = "para1"
a_temp(2) = "para2"
etc.
=myfunction(@a_temp)
Function myfunction
PARAMETERS myarray
FOR counter = 1 to ALEN(myarray)
passed1 = myarray(counter)
ENDFOR
or such code...
Bernard