KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: An alternate way to obtain the value from the parameters
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: January 31, 2002

When you pass one or more parameters into a method, they will be available in that method's local variables $1, $2, $3, ...$n. You can retrieve or use the value of these variables as you would with any other local variables.

For example:


C_TEXT($1;$2;$3)

ALERT("The text value in $1 is "+$1)

ALERT("The text value in $2 is "+$2)

ALERT("The text value in $3 is "+$3)


You can also retrieve the variable by using its numeric value.


For($I;1;Count paramenters)

  ALERT("The text value in $"+String($I)+" is "+${$I})

End for


You could think of $ as an "array" of parameters. Its index indicates the order of parameters.


${Var} is equivalent to $1 -> if Var = 1

${Var} is equivalent to $2 -> if Var = 2

${Var} is equivalent to $3 -> if Var = 3