A typical validation rule is a formula that determines what is to be included or excluded in a field. You can use standard Ability expressions to design the validation rule. The rule will then be compared with any data you attempt to enter into the field. If the data is allowed by the validation rule it will be accepted by the field; if not then the data will be refused and a validation text displayed (see Validation text).
Typical examples of validation rules are:
>= "20" AND <= "40" for a numeric field (allows any numbers from 20 to 40 inclusive)
= "Smith" OR "Jones" for a character or enumerated field (allows only "Smith" or "Jones" but no other names)
Note that the data elements in each of the formulas should be surrounded individually by quotes.
Since a validation rule determines what can be put into a field and will cause an appropriate message to be displayed if the rule is broken, it turns out that a blank field governed by a validation rule will be illegitimate and the validation text displayed as if the rule had been broken. Obviously there are cases where you will want fields to be left empty. To overcome this problem you should do the following:
Add the expression Is Null to the end of the Validation Rule.
Make sure that the Required box is unchecked (this indicates that data is not required)
For example, a validation rule might read:
= "Smith" OR "Jones" OR Is Null
which will allow "Smith", "Jones" or a blank field.
See: