Step 4 Add Rules to iiiSalary Field

Visual LANSA

Step 4. Add Rules to iiiSalary Field

REP007 - File Validation Rules/Triggers

In this step you will create a validation check on the iiiSalary field to ensure that its value is less than 10000. (The field already has a rule stating that it cannot be 0). The rule will be a range check.

1.  The iiiEmployees file should be open in the Editor.  The Rules and trigger tab and Details tab should be visible.

2.  Select the iiiSalary field in the list of rules.

3.  Select the Designer button on the ribbon and expand the Add menu to select Add Range Check.

4.  In the Details tab, create the rule as follows:

Description

Amount must be less than 10000

Sequence

1

When Inserting

Always apply rule (ADD)

When Updating

Apply when field is used (CHGUSE)

When Feleting

Never apply rule

From Value

0.01

To Value

10000

 

5.  Complete the Actions section, to define the list check rule as follows:

If field is in the range of values

Evaluate next rule (NEXT)

If field is NOT in range of values

Set field in error (ERROR)

Message File

(delete the entry in this field)

Message Number

(delete the entry in this field)

Message Text

Amount must be less than 10000

 

6.  Save your file definition.