Step 1. Add a Rule to file iiiDepartments
REP007 - File Validation Rules/Triggers
In this step you will review the field level validation rule defined on the iiiDeptCode field that you created in exercise REP001 - Create Fields. (When you created the iiiDeptCode field, you copied the validation rules from the DEPTMENT field.) You will also add a rule at file level to demonstrate how these rules interact.
1. Open file iiiDepartments in the Editor.
2. Select the
tab.3. Expand the two existing rules to see their complete details. Notice both rules are at field level and cannot be changed using the
tab. (You need to open the field to edit field level rules.)
These rules state that the Department Code and the Department Description codes cannot be blank.
4. Select the iiiDeptCode field in the list of rules to add a file level rule to it.
5. Select
button on the ribbon, and select an rule to the iiiDeptCode field.
6. In the
tab, create the rule as follows to ensure that the Department Code value has to be between A and ZZZ:
|
Your
tab should now look like this:
7. In the
, create the rule actions to set the field in error if it is not in the allowed range:
|
Your
tab should now look like this:
The recommended way to specify the message text is to use a message defined in a Message file as shown in Step 3. Create a Rule for the iiiSalary Field. However, for simplicity in the rest of this tutorial, you will enter the message text in the rule definition.
8. Save the file.