3 3 1 Types of Field Validation Rules

Visual LANSA

3.3.1 Types of Field Validation Rules

In LANSA, the applications business rules or validation checks are centrally defined in the repository at either field or file level. Centralized field validations remove the need for developers to code the same validation into each function that uses the same field. The same types of rule checks are provided for both fields and files.

It is important to understand that field validation rules are performed as part of database file operations. A rule is checked when a file operation (such as an record insert, update or delete) is performed using the specified field.

LANSA provides six types of validation checks in the Repository:

Range of Values: 

Will check if a field is within a given range

Example: check if Employee Number is between A0000 to A9999.

List of Values:

Allows a field to be checked against a list of values

Example: check if the employee's skill Grade is P, F, M or D.

File Entry Lookup:

Allows a field to be "looked up" in a code table or file

Example: check if a Section code exists in the Section file.

Evaluate an Expression: 

Allows a series of conditions to be evaluated to check a field

Example: check if Department code is blank.

Call a User Program: 

Allows field checking by your validation program or LANSA function

Example: call an existing program which validates the day of the week.

Date Format/Range: 

Allows a field to be validated as a date in a certain format (DDMMYYCC, CCYYMMDD etc.) and in a certain range

Example: check that an employee's start date is entered in DDMMYY format and is not in the future.

 

You can often perform the same check using different rules. For example, to test if a field is blank, you could use a List of Values check or an Evaluate an Expression check.

Also See

Field Rules and Triggers Development