Data Lookup Option


Data lookups link a field in one file to additional data in a related file by means of a key field in the related file. In other words, they tell APPX how to access another file during process execution. Lookups are defined for items on images in input, output, and inquiry processes. If the key field is a group, the order that the components are painted on the screen is significant. Parts of the key are assembled from left to right, and top to bottom.

You can define the same field(s) and data lookup more than once on a single image. Each time you define the field, you can designate a data lookup. For example, you may have a Product File Maintenance screen that permits entry of three alternate suppliers. Each Supplier ID is used to perform data lookup in the Supplier file.

Values in the lookup file can display on an image automatically. Auto displays tell APPX which of the values from the lookup file should display on an image. For example, if you define a data lookup to a customer file with a customer number key field, you can automatically display such additional fields as the customer name, address, phone, and contact name without having to execute a DISPLAY statement for each field. If a field is not auto displayed, you must define a DISPLAY statement before the field will appear on the image. (For auto display purposes, the order that fields are painted in on an image is also significant if multiple lookups to the same file are defined. The auto displayed fields must be part of the file that is defined in the preceding data lookup definition, determined from left to right, top to bottom.)

Automatic actions can also be specified if the lookup record is not on file. For example, you can specify whether this should be considered an error or a warning condition.

The Define Data Lookup overlay includes two mutually exclusive overlays that are used to define a data lookup. One screen is for the painted item that represents the first part of the key for a lookup from a specific file and a second is for additional items, if any, that comprise the rest of the key.

When you select the define data lookup option from the Image Item Specifications screen, the overlay shown in Figure 3-14-13 appears.

Figure_3-14-13.png

Figure 3-14-13. Define Data Lookup Overlay

The initial Define Data Lookup overlay contains one field. This field appears on all other Define Data Lookup overlays, as well.

·    Data Lookup Type governs whether or not the value of this item is used as a key, or part of a key, to automatically look up a record in another file. If so, this screen is followed by a specification screen that defines the data lookup. The Data Lookup Type options are:

NONE. There is no data lookup associated with this item.

DEFINE. The value of this item establishes the first, or only, portion of the lookup key value.

CONTINUE. The value of this item establishes the second (or other subsequent) portion of the lookup key value. It must be preceded by an item that is created with a value of Define.

The default value is None.

If you enter Define for the Data Lookup Type, the overlay shown in Figure 3-14-14 appears.

Figure_3-14-14.png

Figure 3-14-14. Define Data Lookup Overlay, Define

If you enter Continue for the Data Lookup Type, the overlay shown in Figure 3-14-15 appears.

Figure_3-14-15.png

Figure 3-14-15. Define Data Lookup Overlay, Continue

The Define Data Lookup overlays for Define and Continue contain the following field in common:

·    Data Lookup File identifies the application and file that is to be read. The following additional fields only display for the Define Data Lookup, Define overlay.

The remaining fields appear on the Define overlay only:

·    Key Field determines the key field in the Data Lookup File that serves as the keypath for a lookup. This key field is identified by its Field Name.

·    File Must Exist? indicates whether or not the file that is entered in Data Lookup File above must exist. If “yes” iconcheckyes.png and the file does not exist, APPX reports an error condition. If “no” iconcheckno.png and the file does not exist, the lookup is not performed. The default is “yes” iconcheckyes.png.

·    Action if NOF governs APPX's response if the referenced record is not on file (NOF) in the Data Lookup File. The Action if NOF options are:

NONE. Takes no action with regard to the NOF condition.

WARNING. Displays a warning message to the user.

ERROR. Displays an error message to the user.

For output processes, APPX prints warnings and errors to the report file. They do not display on the screen. The default is None.

·    Exact Key Req'd? determines whether or not a user must enter a key value that exactly matches a value contained in the file defined for the lookup. If “no” iconcheckno.png, the user can enter a partial key value, and APPX will search for the first record that matches the partial key entry. The user can also enter a complete key value and, if not on file, APPX will retrieve the record with the next highest key value. The default is “yes” iconcheckyes.png.

·    Read Record? governs whether or not the data lookup record is read into the current record area for this file. If “no” iconcheckno.png, APPX performs the lookup and auto displays fields in the lookup record. However, the record read does not affect the current record area in memory, and is not available with statements. This is useful, for example, when you want to establish a lookup to the process control file but do not want to modify the current PCF record. The default is “yes” iconcheckyes.png.