PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Default typecasting of parameters
  • Forcing the typecasting of parameters
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Typecasting of parameters
Default typecasting of parameters
The description of the parameter type is optional. By default, the type of the variable passed as parameter in the call to the procedure is used in the procedure. For example:
Index is int
// Call to MyProc procedure
MyProc(Index)
// // -- Declaration of MyProc procedure
PROCÉDURE MyProc(Counter)
// Counter is an integer
Counter += 1

Therefore, the same procedure can be used for several types of variables.
Forcing the typecasting of parameters
To force the typecasting of parameters, use the following syntax:
PROCEDURE <Procedure name>(<Parameter 1> is <Type>, ...
<Parameter 2> is <Type>, ..., <Parameter N> is <Type>)

The type of the variable passed as parameter (in the call to the procedure) must be the same as the one described in the procedure declaration. Otherwise, an error occurs when compiling the project, window or report.
In the following example, the "Index" variable is not a string: an error will occur when compiling the project, window or report.
Index is int = 7
// Call to MyProc procedure
MyProc(Index)
// -- Declaration of MyProc procedure
PROCEDURE MyProc(Index is string)
...

Remarks:
  • For arrays, see Array parameter and Associative Array parameters.
  • Versions 19 and later
    For Data Source variables, the data source can be associated with a file when typecasting the parameter via the <description> extension attribute. For more details, see Data Source variable.
    New in version 19
    For Data Source variables, the data source can be associated with a file when typecasting the parameter via the <description> extension attribute. For more details, see Data Source variable.
    For Data Source variables, the data source can be associated with a file when typecasting the parameter via the <description> extension attribute. For more details, see Data Source variable.
  • Versions 20 and later
    A light syntax can be used to typecast the parameters: the term "is a" can be deleted:
    PROCEDURE <Procedure name>(<Parameter 1> <Type>, ..., <Parameter N> <Type>)

    For example:
    PROCEDURE MyProc(Index string)
    • A parameter can correspond to any type of variable. A class instance can be passed as parameter to a procedure.
    New in version 20
    A light syntax can be used to typecast the parameters: the term "is a" can be deleted:
    PROCEDURE <Procedure name>(<Parameter 1> <Type>, ..., <Parameter N> <Type>)

    For example:
    PROCEDURE MyProc(Index string)
    • A parameter can correspond to any type of variable. A class instance can be passed as parameter to a procedure.
    A light syntax can be used to typecast the parameters: the term "is a" can be deleted:
    PROCEDURE <Procedure name>(<Parameter 1> <Type>, ..., <Parameter N> <Type>)

    For example:
    PROCEDURE MyProc(Index string)
    • A parameter can correspond to any type of variable. A class instance can be passed as parameter to a procedure.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment