To validate a property or a page means to check its value against certain rules, and add a message to the page if validation fails. An invalid page (a page that has any associated messages) usually cannot be stored into the database.
Process Commander supports three levels of property and page validation.
Mode validation is automatic and always in force; it enforces the property mode during every Property-Set method and every other means of assigning a value to a property.
For example, you cannot set the value of a Single
Value
property to a page, or the value of a Page
Mode
property into a Value List
property.
Dictionary validation examines the property value in the context of the corresponding property rule. (The collection of property rules in your system is sometimes known as the data dictionary.)
For Value mode properties, this processing tests whether the
value passes the tests for its Type. For example, a property
with a Date
type cannot contain
"20030231" or "-15" as the value; a
property of Integer
type cannot contain
"KHWEE." Maximum length and restrictions defined on
the Table Edit tab or Qualifiers tab are also tested.
The system performs dictionary validation when:
Page
When a property fails dictionary validation, the system associates a message to the property. (Such messages are not automatically displayed to an interactive user. As a developer, you can see the messages with the Clipboard tool.)
Obj-Save, Property-Set, and other Property-Set- methods do not cause dictionary validation.
Object validation uses the Obj-Validate method to call a validation rule (Rule-Obj-Validate rule type) to test a set of property values. Object validation is optional and occurs only when explicitly designed into your application. See Validate rule.
Optionally, you can define more restrictions on the values allowed for a Value mode property (of certain Types) using a constraints rule (Rule-Declare-Constraints rule type). The system checks these constraints each time the value is changed.
For example, assume a clipboard property named Diameter has
a value of 6 and the property rule indicates that the
Type is Integer
. If through user
input (or a Property-Set method) the value "Cheese"
is assigned to this property, the new value is
"Cheese" and a message linked to the clipboard
property indicates that the value is property.
In contrast, if a Constraints rule restricts the property Diameter to integers less than 100, an attempt to change the change the value to 107 causes the system to add a message to the clipboard property. The new value 107 passes dictionary editing but violates the constraint rule.
message, type | |
Validating
user input
— Concepts
and terms About Constraints rules About Validate rules About the Clipboard tool Obj-Save method Page-Validate method |