Data Dictionary

File Link Maintenance

 

The File Link Maintenance utility allows you to define and maintain the cross-reference linkages that exist between application data files. Based on existing files with embedded dictionaries defined in Data Dictionary Maintenance, you can specify which files have fields that can be used to populate keys to read cross-reference files to obtain more information. A one-to-one relationship is supported between the files where the fields from one file match the key for the cross-referenced file. For example, an Invoice Header file may contain a client code that can be used to read the Client Master File to obtain the client's name and address, as well as the sales code to obtain the name of the sales representative from the Salesperson file.

The purpose of this utility is to provide link definitions that can be used to simplify specifying relationships in Query Definitions and Views Data Source Definitions, as well as Input Source Definitions in the Report Designer.

With the File Links Express utility, you can quickly create new cross-reference file links to other files in the data dictionary based on the primary key or other unique alternate key of the file being linked to.

(The File Link Maintenance utility was added in PxPlus 2016.)
(The File Links Express utility was added in PxPlus 2023.)

To invoke this utility, use one of the following methods:

Location

Method

From the PxPlus IDE Main Launcher

Expand the Data Management category and select File Link Maintenance.

From the NOMADS Session Manager

From the Dictionary menu, select File Link Maintenance.

From the PxPlus Command line

Enter: LINKS

This window consists of the following:

File To Link

If no File To Link is specified, the default is to display All links. Enter a logical file name to show just the links related to that file.

To query the logical file name by Group or by Name, use any of the following methods:

Click the Query Table View button (magnifying glass) for a tree view of table names by Group. For information on creating a filter to locate a specific table name, see Filtering the Table Names Lookup.

Click the Query button (binoculars) for a query view of tables by table name. For information on using the query features (i.e. search, sort, filter, etc.), see Run-Time Query.

Use the browse buttons to locate a table name.

Link Express

Button that invokes the File Links Express utility for creating multiple links to other files in the data dictionary based on the primary key or other unique alternate key of the file being linked to.

(The Link Express button was added in PxPlus 2023.)

File Links

Displays a list of all currently existing link definitions. This list consists of the link description, the file being linked from, the file being linked to, and the key used to read the latter.

Add

Invokes File Link Definition for adding a new link definition.

Edit

Invokes File Link Definition for editing an existing link definition selected from the list.

Delete

Deletes an existing link definition selected from the list.

Test

Button that is used to test a selected link definition. Click on a link definition row to select it and then click the Test button to display the results in a separate window.

(The Test button was added in PxPlus 2023 Online Update 0001.)

Close

Closes File Link Maintenance.

Note:
When you select a link to add to a Query or Views Data Source Definition, current information from the link definition is copied to the Query or Views interface where it can be modified as desired. Any future changes to the original File Link Definition will have no effect on existing Query or Views linkages. Link definitions specified in a Report Writer report definition, however, use the original File Link Definition references, so changes to File Link Definitions will affect the report.

File Link Definition

File Link Definition is used to add, edit, delete and test file link definitions. You can perform multiple updates in one session.

This window consists of the following:

Link From

Logical file name of the main file whose fields can be used to populate a key to read a cross-reference file.

Click the Query Table View button (magnifying glass) for a tree view of table names by Group. For information on creating a filter to locate a specific table name, see Filtering the Table Names Lookup.

Click the Query button (binoculars) for a query view of tables by table name. For information on using the query features (i.e. search, sort, filter, etc.), see Run-Time Query.

Click the Link Query button (chain link) to select an existing link definition.

To display information about the selected file, hover the mouse pointer over the information button.

Link To

Logical file name of the cross-reference file.

Click the Query Table View button (magnifying glass) for a tree view of table names by Group. For information on creating a filter to locate a specific table name, see Filtering the Table Names Lookup.

Click the Query button (binoculars) for a query view of tables by table name. For information on using the query features (i.e. search, sort, filter, etc.), see Run-Time Query.

To display information about the selected file, hover the mouse pointer over the information button.

Access Key

Key by which to read the cross-reference file (i.e. Link To). To display a more detailed key definition, hover the mouse pointer over the information button.

Record Prefix

A string used to prefix the field names of the cross-reference file record in case there are duplicate field names in the main file. The prefix can be a maximum of 10 characters.

Example:

     The main file and link file may both have a field called ProductCode$. To differentiate the fields, a record prefix of prod would result in the fields in the cross-reference file being prefixed by prod., e.g. prod.ProductCode$.

Note:
Prefixes will be truncated to 4 characters in Query Link Definitions.

Key Expression

A PxPlus expression comprised of fields from the main file, functions, literals and/or global variables that is used to populate the key of the cross-reference file when reading it. A key expression may be string or numeric.

Examples:

     TRN_CUSTID$

     "D"+FLD#2$(1,3)

     PAD(Company$,5,$00$)+PAD(Department$,10,$00$)+STR(EmployeeNum)

     KEY(__fileFN,KNO=0,KEY=Company$:Department$:EmployeeNum)

Multi-Segment Keys

When dealing with multi-segmented keys (i.e. keys made up of more than one field), you can use a + (plus sign) to concatenate multiple string segments of a key when entering a free-form expression. Be sure to add the correct padding logic to the initial key segments. By default, the initial segments of native PxPlus keys are padded with $00$ characters, and the final segment is not padded. Such a key definition might look like this:

     PAD(Company$,5,$00$)+PAD(Department$,10,$00$)+STR(EmployeeNum)

Individual applications can pad key segments with other characters, such as spaces; therefore, knowledge of the key architecture of individual files is a must. Knowledge of segment characteristics is not necessary; however, if the key expression uses the KEY(__linkFN,KNO=n,KEY=FLD1$:FLD2$) format where __linkFN is a special channel variable used by the system when evaluating the key, n is the key number used by the file, and FLD1$:FLD2$ are the key segment variables. The latter format is also more flexible as it can handle changes in key segment length if keys are updated for a file. In addition, this format allows a mixture of string and numeric segments.

Key Expression Builder

An easy way to build a key expression is to use the Key Expression utility, which is invoked by clicking the Tool button next to the Key Expression.

     

The key expression is built by specifying key segments to match the target key definition. These segments can consist of fields from the parent file, literal values and variables. Partial items can be defined, and segments can be padded, have characters stripped, or be converted to upper/lower case.

In the case of multi-segment keys, a Generate a KEY=F1$:F2$ expression check box option is available:

If it is not selected, the key segments will be concatenated, and individual key segments would have to be padded or manipulated appropriately.

If it is selected, then a key expression in the format KEY(__linkFN,KNO=n,KEY=FLD1$:FLD2$) will be generated where the segments need not be manipulated. (For an explanation of the contents of the generated key, see Multi-Segment Keys.)

Simple numeric keys can be built using a numeric field. Multi-segment numeric keys should be built using the Generate a KEY=F1$:F2$ expression option.

(The Generate a KEY=F1$:F2$ expression check box was added in PxPlus 2023.)
(Support for numeric key definitions when defining key expressions in file links was added in PxPlus 2023 Update 1.)

Link Description

A unique description to identify the file link definition.

Test

Tests the current file link definition and displays the results in a separate window.

Save

Saves/updates the file link definition.

Delete

Deletes the selected file link definition. Prior to deleting the file link, a message will display.

Clear

Clears the fields and leaves the File Link Definition window open.

Close

Closes File Link Definition and returns to File Link Maintenance. If any unsaved changes are detected, a message will display.

File Links Express

The File Links Express utility allows you to quickly create new cross-reference file links to other files in the data dictionary based on the primary key or other unique alternate key (see Defining Keys) of the file being linked to.

Example:

The primary key (Country$) for the Countries file may exist in a number of other files in the data dictionary that are not currently linked to it. This utility will search the data dictionary for all files that contain a Country$ field and list them as possible cross-reference files.

Options for each cross-reference file can be defined individually, or the Edit All feature (in top row) can be used for a specific column to apply the option for all the tables in the list.

(The File Links Express utility was added in PxPlus 2023.)
(The ability to select other unique alternate keys, besides Primary key, was added in PxPlus 2023 Online Update 0001.)

To invoke the File Links Express utility, click the Link Express button in File Link Maintenance.

This window consists of the following:

File to Link to

Enter the table to search for potential links to other files in the data dictionary based on key information.

Select Key

Select the table key from a list of unique keys on which to base the link definition.

(The Select Key drop box was added in PxPlus 2023 Online Update 0001.)

(Links Grid)

Grid that is used to add or edit file links. This grid consists of the following:

Edit All

The changes made to the Prefix, Key Expression or Make Link options in this row will be applied to all the tables in the list.

Link from Table

List of tables linked to the File to Link to entry. The initial list consists of tables that share the fields of the selected key of the File to Link to.

To add additional tables that may have different field names that correspond to the selected key, click the Add a new link button and either enter the new table name or click the lookup button to select a table.

Link Description

Description of the link. Must be unique. A default description consisting of the Link from Table and the File to Link to is provided for new links but may be changed.

Prefix

Prefix to use for the record prefix of the File to Link to.

Key Expression

Key expression based on fields from the Link from Table that is used to read the File to Link to. Default is the selected key of the File to Link to.

Enter the Key expression in the grid or click the dotted button to invoke the Key Expression utility.

Make Link

Select the check box to include the entry when updating the file links.

Test the selected link

Button that is used to test a selected link definition. Click on a link definition row to select it and then click the Test button to display the results in a separate window.

(The Test button was added in PxPlus 2023 Online Update 0001.)

Add a new link

Button that is used to add a table to the list.

Remove selected table from list

Button that is used to remove the selected table from the list only. Does not remove the file link definition from the system.

To remove a file link definition, select the table in File Link Maintenance and click the Delete button.

View Log

(Available when additions or changes have been applied)

Displays the log file that contains a list of link definitions that have been added or updated. The contents are displayed as a PDF, which also provides options for printing or saving the log, if desired.

Apply

Saves the file link definitions that are indicated by the Make Link entries.

Whenever link definitions are applied, a log file is updated. The log entries are cumulative as links to different files are applied.

Exit

Closes the File Links Express utility. If changes have been made to the file link definitions but not applied, a message will display. If records exist in the log file, a message will ask if you want to view the log.