ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Debug functions
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
Used to find out and signal the possible errors via an assertive programming. dbgAssert is used in a code where a possible error may occur. A window signals the problem if an error occurs.
This mode is used by default in test mode and it can be enabled at runtime by dbgEnableAssert.
Example
// The procedure named FindCustomer(Number) is used to find the specified customer
PROCÉDURE FindCustomer(Number)
HReadSeekFirst(Customer, Number, Number)
dbgAssert(HFound, "Customer not found")
// SoughtValue was passed as parameter, it should exist in the data file.
// Position on the record
HReadSeekFirst(FileName, ItemName, SoughtValue)
// Check whether a record was found
// (in all cases, "standard" or "debug" mode)
IF HFound(FileName) = False THEN
// In "debug" mode, display a message to indicate that a problem occurred
dbgAssert(False, StringBuild("The %1 record of" + ...
"FileName was not found", SoughtValue))
// Manage this case in the code by creating a record if it was not found
HReset(FileName)
FileName.ItemName = SoughtValue
HAdd(FileName)
END
Syntax
dbgAssert(<Condition to check> [, <Comment>])
<Condition to check>: Character string
Condition whose test must be run. This condition can be a WLanguage function, a local or global procedure, an expression, ...
<Comment>: Optional character string
Text that will be displayed (in a window) if the condition is not checked.
Remarks
  • In test mode, the management of assertions is enabled by default.
  • At runtime, the management of assertions is disabled by default. dbgAssert is not run. The WLanguage function specified in parameter will not be run.
  • There is no need to use InTestMode when the management of assertions is enabled. This function was commonly used to monitor a specific operating mode that can now be done with dbgAssert.
  • WEBDEV - Server code When this function is used in an Active WEBDEV Page, assertions are not displayed.
    Indeed, the execution of the pages in AWP mode is performed by the Web server, and the Web server cannot create interfaces.
  • Android The messages of dbgAssert will be written into the ADB log (at "Assert" level). For more details, see Managing ADB logs.
Component: wd290vm.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/03/2023

Send a report | Local help