Defining the expression

A validation rule is a boolean expression. PocketBuilder applies the boolean expression to an entered value. If the expression returns TRUE, the value is accepted. Otherwise, the value is not accepted and an ItemError event is triggered.

What expressions can contain

You can use any valid DataWindow expression in validation rules.

Validation rules can include most DataWindow expression functions. A DataWindow object that will be used in PocketBuilder can also include user defined functions. DataWindow expression functions are displayed in the Functions list and can be pasted into the definition.

For information about these functions, see the DataWindow Reference in the online Help.

Use the notation @placeholder (where placeholder is any group of characters) to indicate the current column in the rule. When you define a validation rule in the Database painter, PocketBuilder stores it in the extended attribute system tables with the placeholder name. During execution, PocketBuilder substitutes the value of the column for placeholder.

Pasting the placeholder

The @col can be easily used as the placeholder. A button in the Paste area is labeled with @col. You can click the button to paste the @col into the validation rule.

An example

For example, to make sure that both Age and Salary are greater than zero using a single validation rule, define the validation rule as follows:

@col > 0

Then associate the validation rule with both the Age and Salary columns. At runtime, PocketBuilder substitutes the appropriate values for the column data when the rule is applied.