Field Definitions

$FIELDS/ENDFLDS

$FIELDS

$ENDFLDS

The $FIELDS/$ENDFLDS command pair defines the beginning and ending of the field name definitions section. Fields are defined here and immediately follow the formatted lines (in the $FORMAT/$ENDFMT section) that they apply to.

A field name definition consists of the five following items in a fixed columnar format. Columns not listed are blank.

Position Definition

2-4

Field identifier.

8-27

4GL field name without the group prefix (that is defined with the $PREFIX command).
31-44 Element. See Element Reference Syntax in Report Files

47-48

Field type.

52-61

Print control specification.
64-88 Value list.

Field Identifier

The field identifier name consists of an alphabetic character (A-Z), optionally followed by up to two numeric characters. Examples of field identifiers are C31, A, F4. This field identifier must be the same identifier used in the field definition line in the $FORMAT section.

An asterisk (*) is a special field identifier that lets you define values for a translation field. A translation field has a field type of X. For more information, see Field Type.

To define values for a translation field, redefine the translation field as a translation values field. A translation values field must have an asterisk (*) in column 2, a field type of XV, and immediately precede the translation field. For more information, see Value List.

When you run the report, the translation value prints rather than the database value. The size of the field in the $FORMAT section should be the size of the longest translation value. The name of the translation value field can be the same as the name of the translation field.

In the example below, the report would print "Posting" instead of "P" and "Summary" instead of "S" for the GLN-POSTING-FLAG field.

1 *     GLN-POSTING-FLAG                       XV         P=Posting
1                                                         S=Summary
1 F1    GLN-POSTING-FLAG                       X                  

Field Name

The field name is the 4GL field name without the group prefix. A field name can have up to 20 characters. The combination of a group prefix and a field name cannot exceed 29 characters. The combination must be unique for a program.

Field Type

The field type coded value defines the data type of the field supplying the variable on the report line. The following are the valid field types and their formats. These are the only fields types that require an entry in the Type column.

Type Description Internal format Report format(s)
TD Today's Date YYMMDD ZZ/ZZ/ZZ, XXX/ZZ/ZZ
DT Date YYMMDD ZZ/ZZ/ZZ, XXX/99/99
SD Short Date MMDD

ZZ/ZZ

XXX/99

CD Century Date YYYYMMDD ZZ/ZZ/ZZ, XXX/99/9999
CT Current Time* HHMMSSHH

99:99

99:99:99

TF Time Format HHMMSSHH 99:99:99:99, 99:99:99
PN Page Number 9(04) ZZZZ
TN Telephone Number 9(10) (999)999-9999
PC Percent Two decimals left

99%, 99.9

ZZ.ZZ%

DV Decimal Varying S9(08)V9(05) ZZ,ZZZ.99
X Translation Translation field size Translation field size
XV Translation Values None None
Note: Field types TD, CT, and PN are supplied by the system and are not available for user-filled values.

In addition, the Page Number field is designed to be a maximum of four characters in length. If you have a report that may print more than 9,999 pages, you should adjust the placement of the Page Number field. This adjustment can be done by moving the field so that it is not directly on the right margin, or by putting more than one space between it and the word "Page." If necessary, at runtime the Lawson Environment will then be able to adjust the display of the page numbers to accommodate more than four characters.

Print Control

The following are the valid print control entries.

Use To
TOTFLD Designate a total field. This entry is valid in a standard footer group only. When a page break occurs and the standard footer prints, the total field clears.
NODUPS Keep duplicate fields from printing. This entry is valid in a normal group. The field does not print if the value of the field has not changed from the last time the group printed.
NOKEYDUPS Only print the field the first time the group prints after the program does a MOVE to the field. This entry is valid in a normal group.

Value List

The value list column defines the translation values that you want the report to print in place of the database values of a field. You can define translation values next to fields that have an asterisk (*) as a field identifier and a type of XV. For more information on translation fields, see Field Identifier.

To define a translation value, use the format

Value=Translation

Value is the database value of the field. Translation is the value you want the report to print for that database value. In the following example, the report prints "Active" when the value of GLM-ACTIVE-STATUS is A, and "Inactive" when the value of GLM-ACTIVE-STATUS is I.

*      GLM-ACTIVE-STATUS      XV               A=Active
                                               I=Inactive
M      GLM-ACTIVE-STATUS      X

To define foreign language translations, use the format

Value^DisplayValue=Translation

Value is the database value for that field. DisplayValue is the value you want the report to print for that database value. Translation is optional. If you have a Translation, the report prints the translation rather than the DisplayValue. The following definition would print the German translation for GLM-ACTIVE-STATUS.

*      GLM-ACTIVE-STATUS      XV               A^A=Aktiv
                                               I^I=Unaktiv
M      GLM-ACTIVE-STATUS      X