In LANSA, the applications business rules or validation checks are centrally defined in the Repository at either field or table 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 tables.
It is important to understand that field validation rules are performed as part of database table operations. A rule is checked when a table 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.
Table Entry Lookup:
Allows a field to be "looked up" in a code table or table
Example: check if a Section Code exists in the Section table.
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.
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.