KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using the OP Set option command to do error checking
PRODUCT: 4D Open | VERSION: 6.8 | PLATFORM: Mac & Win
Published On: July 25, 2002

While it is sometimes ignored, the 4D Open command OP Set option can be a powerful debugging tool. One of the useful options provided by OP Set option is the ability to check the parameters passed to a 4D Open command. By setting Option 1 to "on" (which is what it is set to by default), 4D Open will check the validity of each parameter passed to 4D Open. By using this feature during the debugging phase of development you can determine errors in your code before deploying to an end-user. If the parameter debug option is turned on, for example when a table number is passed as a parameter to a 4D Open command, 4D Open will send a request to the server database to check whether the table exists. One note is that by having the debug option turned on, it will slow down database operations.

Example:

`Toggle the parameter checking

C_LONGINT($ErrCode)

If(vDebug= TRUE)
$ErrCode := OP Set option (1;1) `turn debug on
else
$ErrCode := OP Set option (1;0) `turn debug off
end if