|
|
|
|
|
Parameters of a procedure with a variable number of parameters
When the procedure uses a variable number of parameters, you must be able to handle the different parameters passed to the function in the code of the procedure. These operations are performed by the MyParameters keyword. Procedure used to shift the controls: The controls passed in parameters are shifted by 10 pixels. // Procedure used to shift controls PROCEDURE ShiftControl(*)  FOR I = 1 _TO_ MyParameters..Count MyParameters[I]..X +=10 END Procedure used to delete characters from a string. PROCEDURE DeleteCharacter(LOCAL FullString is string, *)  CleanedString is string = FullString  FOR ParameterSubscript = 2 _TO_ MyParameters..Count - 1 CleanedString = Replace(CleanedString, MyParameters[ParameterSubscript], "") END  RETURN CleanedString The parameters are always indexed from 1 regardless the number of mandatory parameters or the number of optional parameters. Example: PROCEDURE Proc(p1, po2= "Z", *)
| | | | Call | Proc("A") | Proc("A", "B") | Proc("A","B", "C") | MyParameters..NbReceived | 1 | 2 | 3 | MyParameters..Count | 2 | 2 | 3 | MyParameters[1] | "A" | "A" | "A" | MyParameters[1]..Default | False | False | False | MyParameters[2] | "Z" | "B" | "B" | MyParameters[2]..Default | True | False | False | MyParameters[3] | WLanguage error | WLanguage error | "C" | MyParameters[3]..Default | WLanguage error | WLanguage error | False |
A variable number of parameters can be used with: - the procedures,
- the methods of classes,
- the declaration code of global variables of windows, pages or reports.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|