ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax / WLanguage procedures / Procedure parameters
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
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", *)
CallProc("A")Proc("A", "B")Proc("A","B", "C")
MyParameters..NbReceived123
MyParameters..Count223
MyParameters[1]"A""A""A"
MyParameters[1]..DefaultFalseFalseFalse
MyParameters[2]"Z""B""B"
MyParameters[2]..DefaultTrueFalseFalse
MyParameters[3]WLanguage errorWLanguage error"C"
MyParameters[3]..DefaultWLanguage errorWLanguage errorFalse

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.
Remark: The type of a parameter is returned by GetDefinition.
Minimum version required
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/03/2023

Send a report | Local help