PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 in parameter during the call to the procedure is used in the procedure. For example:
Subscript is int
// Call to MyProc procedure
MyProc(Subscript)
// // -- Declaration of MyProc procedure
PROCEDURE 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 variable passed in parameter (during the call to the procedure) must be identical to the type described in the declaration of the procedure. Otherwise, an error occurs when compiling the project, the window or the report.
In the following example, the "Subscript" variable is not a string: an error will occur when compiling the project, the window or the report.
Subscript is int = 7
// Call to MyProc procedure
MyProc(Subscript)
// -- Declaration of MyProc procedure
PROCEDURE MyProc(Subscript is string)
...
Notes:
  • For the arrays, see Array parameter and Associative Array parameters.
  • Versions 19 and later
    For the Data Source variables, the data source can be associated with a file when typecasting the parameter via the <description> extension attribute. See Data Source variable for more details.
    New in version 19
    For the Data Source variables, the data source can be associated with a file when typecasting the parameter via the <description> extension attribute. See Data Source variable for more details.
    For the Data Source variables, the data source can be associated with a file when typecasting the parameter via the <description> extension attribute. See Data Source variable for more details.
  • Versions 17 and later
    AndroidAndroid Widget Java You now have the ability to force the typecasting of parameters.
    New in version 17
    AndroidAndroid Widget Java You now have the ability to force the typecasting of parameters.
    AndroidAndroid Widget Java You now have the ability to force the typecasting of parameters.
  • 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(Subscript string)
    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(Subscript string)
    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(Subscript string)
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment