KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: The 4D OK variable does not always indicate an error has occurred
PRODUCT: 4D | VERSION: 15.1 | PLATFORM: Mac & Win
Published On: January 14, 2016

The 4D OK variable does not always indicate an error has occurred! This means is that for comprehensive error trapping, simply checking if the OK variable is set to 1 is not enough. Judicious use of error methods and ON ERR CALL is the only way be assured of knowing if an error has occurred.

Errors can occur in many 4D commands and value or the OK variable remains 1. The documentation for many commands will specifically state this fact, but not all.

For example, the documentation for TEXT TO DOCUMENT contains the Note,

"This command does not modify the OK variable. In case of failure, an error is generated that you can intercept using a method installed by the ON ERR CALL command."

Many other commands do not set or mention the OK variable and simply state somethig like "an error is generated."