Examining a relationship between files

You can display detail information about the relationship that exists between two files. Some fields are keys in more than one file. For example, if you have a customer file and a file of contacts who work for that customer, both files might use CUSTOMER_NUM as a key. This type of key is called an access key. If two files have the same key, there is a link between them, as shown in figure 1.

1. Two files linked by an access key.

Some files contain fields that are keys in other files, even though they’re not keys in the original file, . This is referred to as a foreign key. An order file, for example, would contain CUSTOMER_NUM of the customer who made the purchase. Thus, there is a link from the order file to the customer file, as shown in figure 2. The customer number in the order file is a foreign key.

2. Two files linked by a foreign key.

You can examine the relations between files from either the Files to Read list or the Available Relations list using the Examine relation function. (Examining temporary relations is allowed only from the Files to Read list.) This function is available only when two or more files have been selected as Files to Read.

1. Highlight either the relation or a file in the relation that you’d like to examine.
2. From the Relation functions or File functions menu, select Examine relation.

The Examine Relation window is displayed. This read-only window describes the key segments that are used in the current relation. It contains the names of the “from” file, structure, and key and the names of the “to” file, structure, and key. (If you’re examining a temporary relation based on a name link, the name of the “from” key will be “NAME_LINK_KEY.” This key is a temporary one that ReportWriter has created for use in this report.)

3. Examining a relationship between files.

If a key allows duplicates, the word “Dups” is displayed to the right of the key name. The segment information includes the type and size of each key segment:

F = Field

L = Literal

E = External

R = Record number

If the segment is a field or external segment, the field name is specified. You can display the field description instead of the field name by selecting Examine relation > Toggle view. If the segment is a literal, the literal string is displayed.

You can view this information for any file (except the first in the Files to Read list), but it is most useful when a given file/structure combination is related to another file/structure combination more than once (using different keys). When displayed in the Available Files list, these file/structure combinations appear to be the same. The Examine relation function enables you to view the specific relationship that each one represents.

3. To exit the Examine Relation window, press the Exit shortcut.