CHAPTER 8 Displaying and Validating Data
DataWindow Designer User’s Guide 259
For information about these functions, see the DataWindow Object Reference.
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, DataWindow Designer stores it in the extended attribute
system tables with the placeholder name. At runtime, DataWindow Designer
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, DataWindow Designer substitutes the appropriate values for the
column data when the rule is applied.
Using match values for character columns
If you are defining the validation rule for a character column, you can use the
Match button on the Definition page of the Validation Rule view. This button
lets you define a match pattern for matching the contents of a column to a
specified text pattern (for example, ^[0-9]+$ for all numbers and ^[A-Za-z]+$
for all letters).
❖ To specify a match pattern for character columns:
1 Click the Match button on the Definition page of the Validation Rule view.
The Match Pattern dialog box displays.
2 Enter the text pattern you want to match the column to, or select a
displayed pattern.
3 (Optional) Enter a test value and click the Test button to test the pattern.
4 Click OK when you are satisfied that the pattern is correct.
For more on the
Match function and text patterns, see the DataWindow Object
Reference.