Creating an environment field

Environment fields are used to obtain data from the system environment. Like question fields, the contents of environment fields remain static throughout report generation and are discarded when the report is completed. Also like question fields, environment fields can enable a single report definition to generate similar yet differing reports. While question fields require the user to supply the distinguishing parameters, environment fields draw these values from the environment.

Here are some examples of values that might be drawn from the environment:

ReportWriter loads the contents of environment fields in one of two ways. One method is to load it with the contents of a shell or operating system value. The other method is to load it with the contents of a Synergy DBL SEND/RECV message. (See Defining the contents of environment fields for information on customizing ReportWriter’s environment field processing routine for your particular environment.)

1. Select Design > Fields to create.

You can select the Fields to create function from any of the Design function windows, enabling you to create temporary fields while specifying other report information.

When you select Fields to create, the Temporary Fields list is displayed. If you are creating a new report or adding temporary fields for the first time, the Available Field Types list is also displayed.

2. Select Environment Fields from the Available Field Types list.

1. Defining an environment field.

3. In the Environment Field Definition window, enter data in each field as instructed below.

As an example, we’ve defined an environment field that gets the name of the firm at which you’re running the report. (We’ve assumed that this information is stored in a firm master file record on the system.)

Field name

Enter a name to identify the field. This name must be unique among all temporary fields. It must begin with a letter and the remaining characters can be letters, digits, underscores (_), or dollar signs ($).

We called our environment field FIRMNAME.

Type

Specify the type of your environment field:

Alphanumeric

Numeric

Date

Time

Our example field is Alphanumeric.

Description

Enter a description for the environment field. The default is the field name. This description is used as the default field header when this field is printed, and when it is listed in the Print Fields list, Sort Fields list, or the list of available fields.

We thought a good description was Name of this firm.

Format

Enter the display format that should be used for this environment field.

To display a list of existing formats, select Field functions > List selections. If the field is not a date or time field, a list of the global formats from the repository is displayed. If the field is a date or time format, a list of predefined display formats is displayed. Select a format from the list. Do not enter your own format; ReportWriter will treat the field as a normal decimal field. (See Appendix B: Date and Time Formats for a list of predefined redisplay formats.)

Make sure you read Modifying temporary fields for important information about modifying a temporary field’s format after it has been selected as a field to print.

Since the FIRMNAME field is the name of a company, we didn’t need to enter a format.

User text

Enter a 40-character user-defined text string associated with this field. (For information on how this text string can be used, see Defining the contents of environment fields.)

Our example didn’t require a user text string.

Length

Enter the length of the environment field.

When we looked at our firm master file record, we saw that firm names are stored in an a50 field. Therefore, we entered an environment field length of 50.

Precision

If this is a Numeric field, enter the number of characters to the right of the decimal point. The maximum number is 10. The default is 0.

Date format

If this field is a Date field, a selection window displays the date storage formats for this environment field. Select how you want the specified data to be stored by ReportWriter during report generation. If this field is not a date field, a 0 is entered by default.

Justification

Select how you want the display of this data to be justified: Left, Right, or Center.

Since this is a name, we selected Left.

You can cancel creation of your environment field by pressing the Abandon shortcut.

4. To save your new environment field definition, exit the window.