Form Rules

A form rules file is a Lawson 4GL file that enables you to define data access routines for your application.

Each system in a product line can have a form rules file. The form rules file name follows the format

%LAWDIR%\productline\systemcodesrc\systemcode.sr

For example, the form rules file for the product line lawapp9 and the system code AP is:

%LAWDIR%\lawapp9\apsrc\AP.sr

Form Rules Objects

You can define five types of objects in a form rules file. A DEFINE statement identifies each object type.

Data access description Form rule See
Access data without displaying all field values on a form. DEFINE FUNCTION Functions
Define how to display data for fields that can be either numeric or alpha. DEFINE NUMERIC Numerics

Define the data that a select window displays,

- or -

Define the fields you can search for in a Find window.

DEFINE SELECT Selects
Define the data that the Drill Around (F5) function key accesses. DEFINE SCRDTL Form Detail
Update data in other form fields when the cursor leaves a form field. DEFINE RULE Rule Definition

Form Rules Guidelines

  • Define form fields (SCRFLD) and functions (FUNCTION) before using them in other object definitions. You can define other objects in any order.

    The standard for a form rules file is to define the object types in the order listed in the preceding table.

  • Begin each object definition in the form rules file with a DEFINE statement.

    • Although spacing does not matter, you must list a DEFINE statement's entries in the order they are listed.

    • Each DEFINE statement and each of its entries must be on a separate line.

    • A "\" at the end of a line means that the entry continues on another line.

    • Each DEFINE statement and each of its entries must be uppercase and spelled as shown. However, titles or labels that are enclosed in double quotes (" ") need not be uppercase.

  • Every DEFINE statement except FUNCTIONs must have an ID field which matches the system code, and the value of the ID must be unique.

    Lawson recommends that IDs are of the form:

    SystemCode-FilePrefix-RuleType-4 digits

    The following are valid rule types.

    • W = object window

    • V = object view

    • N = numeric rules

    • R = rule

    • S = select

    • D = screen detail

  • You can enter comments in the form rules file by typing an asterisk (*) in column 1 of the line. The remainder of the line is then treated as a comment.

  • When changing the size of the field to be displayed using the DSPFLDS entry, be aware of the following:

    • You cannot make the displayed field size larger than the original size (and you cannot make the size of the decimal portion of a field larger than the original size).

    • Though the field is truncated in the Select window, the entire field appears in the resulting display.

    • Decimal fields round.

    • For percent fields, you must define at least two decimal places, which display the value as a whole number percent.

    • You cannot modify the display of formatted fields, such as DATE and TIME.