Err Global Variable
See Also: Global Variables Used by Data Dictionaries
Purpose
To provide a means for determining if an error has been generated, and for restoring the error indication to negative.
Type
Boolean
What It Does
Whenever a runtime error occurs in DataFlex, Err is set to true. After the occurrence of the first error, Err remains true until it is reset to false by an explicit command.
If (Err) Begin
Send Stop_Box "An Error was Encountered"
End
Move False to Err
If Err is true when the first line above is executed, it displays the message "An Error was Encountered". The next line unconditionally resets Err to false.
If (Err) Begin
Send DoUpdate
End
If Err is true when this line of code is executed, the procedure DoUpdate is executed. DoUpdate would typically have a "Move False to Err" line in it.
Notes
- Never rely on the value of the
Errindicator other than on the line immediately following the line of code that sets it. Many different commands and messages alter the value ofErr. It is best to move the value ofErrto a local variable if you need to use its value later in your code:
Boolean bErr
:
Send Request_Save of oCustomer_DD
Move (Err) to bErr
:
If (bErr) Begin
:
End