Object Rules

An object rules file is a Lawson 4GL file in which you can define the Drill Around process that the Drill Around (F5) function key follows. Object rules define the files and records that the Drill Around feature accesses, and the format of the windows that display those records.

When you use the Drill Around feature on a record in a Select window, the DEFINE OBJWIN and DEFINE OBJVIEW entries in the object rules file display detail windows and views associated with the data file called by the Select window. If more than one detail window or view is available, a Select window displays with a list. When you select an object window from a Drill Around selection list, a Drill Around window displays.

Each system in a product line can have an object rules file. The object rules file name has the format:

$LAWDIR/productline/systemcodesrc/systemcode.or

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

$LAWDIR/lawapp9/apsrc/AP.or

You can define two kinds of objects in an object rules file:

An object window displays selected data from a database record and is created using a DEFINE OBJWIN statement.

An object view ties a database record to records that have a one-to-many relation to it and displays them. You can then select the record that you want to see detail for. An object view is created using a DEFINE OBJVIEW statement.

The define form detail (DEFINE SCRDTL) statement, defined in the form rules file, initiates the Drill Around process that object rules follow. When you use the Drill Around feature from a form field, the SCRDTL rule for that field accesses the database record for the value of that field. Then it finds all the object windows and object views that have the same FILENAME as the SCRDTL rule and displays their titles in a Drill Around select window. If SCRDTL finds only one object window or object view with the same FILENAME, it displays that object window or object view rather than the Drill Around select window.

For example, assume that a form has three fields—Company, Vendor, and Invoice—and that each field has a SCRDTL rule that points to a record in a database file and to object windows and object views. When you use the Drill Around feature from the Company field, the SCRDTL rule for that field accesses the record for the company whose number you have typed in the Company file and displays a Drill Around select window with the titles of all the object windows and object views defined for the Company file.

Object Rules Guidelines

Standards for defining object rules are as follows:

  • Enter the file name as a comment, define the object windows of that file, and then define its object views.

  • Define object rules in any order.

  • Begin each object definition in the object 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.

    • 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 in the object rules 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 object 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 display using the WINFLDS and DSPFLDS entries, 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 or Object window, the entire field appears in the resulting display.

    • Decimal fields round.

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

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