| 4D v18Asserted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | 
    4D v18
 Asserted 
         | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Asserted ( boolExpression {; messageText} ) -> Function result | ||||||||
| Parameter | Type | Description | ||||||
| boolExpression | Boolean |   | Boolean expression | |||||
| messageText | Text |   | Text of error message | |||||
| Function result | Boolean |   | Result of evaluation of boolExpression | |||||
The Asserted command has an operation similar to that of the ASSERT command, with one difference in that it returns a value which is the result of the evaluation of the boolExpression parameter. It therefore allows the use of an assertion during the evaluation of a condition (see the example). For more information about the operation of assertions and the parameters of this command, please refer to the description of the ASSERT command.
Asserted accept a Boolean expression as a parameter and returns the result of the evaluation of this expression. If the expression is false and if the assertions are enabled (see the SET ASSERT ENABLED command), the error -10518 is generated, exactly as for the ASSERT command. If the assertions are disabled, Asserted returns the result of the expression that was passed without triggering an error.
Note: Like the ASSERT command, Asserted works in interpreted and compiled mode.
Insertion of an assertion in the evaluation of an expression:
 READ WRITE([Table 1])
 LOAD RECORD([Table 1])
 If(Asserted(Not(Locked([Table 1]))))
  // This code triggers the error -10518 if the record is locked
    ...
 End if
	Product:  4D
	Theme:  Interruptions
	Number:  
        1132
        
        
        
	
	Created:  4D v12
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	4D Language Reference ( 4D v18)
	
	
	
	
	
 Add a comment
Add a comment