Defining validation rules
260 DataWindow .NET
Customizing the error message
When you define a validation rule, DataWindow Designer automatically
creates the error message that displays by default when users enter an invalid
value:
'Item ~'' + @Col + '~' does not pass validation test.'
You can edit the string expression to create a custom error message.
Different syntax in the
DataWindow object
painter
If you are working in the DataWindow object painter, you can enter a string
expression for the message, but you do not use the @ sign for placeholders. For
example, this is the default message:
'Item ~'' + ColumnName + '~' does not pass validation test.'
A validation rule for the Salary column in the Employee table might have the
following custom error message associated with it:
Please enter a salary greater than $10,000.'
If users enter a salary less than or equal to $10,000, the custom error message
displays.
Specifying initial values
As part of defining a validation rule, you can supply an initial value for a
column.
❖ To specify an initial value for a column in the Database painter:
1 Select Properties from the column's pop-up menu and select the Validation
tab.
2 Specify a value in the Initial Value box.
Defining a validation rule in the DataWindow painter
Validation rules you assign to a column in the Database painter are used by
default when you place the column in a DataWindow object. You can override
the validation rule in the DataWindow object painter by defining an ad hoc rule
for one specific column.