With the Valid attribute, the current state of the validation rules of the variable or a value of the variable can be queried.
Syntax | |
Valid | |
Return value | |
Type |
Description |
enumValid |
The validation state |
Parameter | |
None |
enumValid |
Description |
0 – enValid |
The validation state of the list is valid |
1 – enValidWarning |
The validation state of the list valid, but warnings are notified (reserved for later versions of TCE). |
2 – enInvalid |
The validation state of the list is invalid. |
Example:
A list variable with rules is created in a class:
Running the code with an object of this class:
Colors.Clear
Server.CheckRules
MsgBox(Colors.Valid = TCEServer.enumValid.enValid)
#Shows False, because an empty list is invalid (because of NoValue)
Colors.Add({"red", "green"})
Server.CheckRules
MsgBox(Colors.Valid = TCEServer.enumValid.enValid)
#Shows True, because all list entries have valid rules
Colors.Add({"red", "green", "blue"})
Server.CheckRules
MsgBox(Colors.Valid = TCEServer.enumValid.enValid)
#Shows False, because the value blue is invalid (Value is missing in the validation definitions)