# File Link Maintenance

> Source: https://manual.pvxplus.com/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](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/overview)**, 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](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/query-definition)** and **[Views Data Source Definitions](https://manual.pvxplus.com/views-system/data-source-maintenance/data-source-definition#step3)**, as well as **[Input Source Definitions](https://manual.pvxplus.com/report-writer/designing-a-report/defining-the-data/input-source)** in the **[Report Designer](https://manual.pvxplus.com/report-writer/designing-a-report/report-designer/overview)**.

With the **[File Links Express](https://manual.pvxplus.com/data-dictionary/file-link-maintenance#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.)*

![](https://manual.pvxplus.com/migration-assets/19d808eeaefa0528b2e5281382fe8ad6f14365f5adc60afc0d93699eaaa84049.jpg)

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

| **Location** | **Method** |
| --- | --- |
| From the **[PxPlus IDE Main Launcher](https://manual.pvxplus.com/pxplus-ide/ide-main-launcher)** | Expand the *Data Management* category and select *File Link Maintenance*. |
| From the **[NOMADS Session Manager](https://manual.pvxplus.com/nomads-graphical-application/nomads-development/getting-started#sessionmgr)** | From the *Dictionary* menu, select *File Link Maintenance*. |
| From **[Data Dictionary Maintenance](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/overview)** | On the Main panel, use the **[Define File Links](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/overview#file_links)** button (*chain link with drop-down arrow*) to invoke **File Link Maintenance** either by clicking the chain link or by clicking the drop-down arrow and selecting *File Link Maintenance* from the displayed menu.<br>*(The Define File Links button in Data Dictionary Maintenance was added in PxPlus 2025.)* |
| From **[Data Dictionary Maintenance](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/overview)** | From the *Utilities* 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.<br>To query the logical file name by Group or by Name, use any of the following methods:<br>\|  \|  \|<br>\| --- \| --- \|<br>\| • \| 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](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/filtering-the-table-names-lookup)**. \|<br>\| • \| 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](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/run-time-query)**. \|<br>\| • \| Use the browse buttons to locate a table name. \| |
| *Link Express* | Button that invokes the **[File Links Express](https://manual.pvxplus.com/data-dictionary/file-link-maintenance#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.<br>*(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](https://manual.pvxplus.com/data-dictionary/file-link-maintenance#linkdefinition)** for adding a new link definition. |
| *Edit* | Invokes **[File Link Definition](https://manual.pvxplus.com/data-dictionary/file-link-maintenance#linkdefinition)** 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.<br>*(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](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/query-definition) or [Views Data Source Definition](https://manual.pvxplus.com/views-system/data-source-maintenance/data-source-definition#step3), 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.

![](https://manual.pvxplus.com/migration-assets/18a57763797b97e94b147294f153dc77e7ac794f4233892b717261eaab50394e.png)

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.<br>\|  \|  \|<br>\| --- \| --- \|<br>\| • \| 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](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/filtering-the-table-names-lookup)**. \|<br>\| • \| 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](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/run-time-query)**. \|<br>\| • \| Click the Link Query button *(chain link)* to select an existing link definition. \|<br>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.<br>\|  \|  \|<br>\| --- \| --- \|<br>\| • \| 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](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/filtering-the-table-names-lookup)**. \|<br>\| • \| 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](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/run-time-query)**. \|<br>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.<br>***Example:***<br>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$.*<br>Note:  <br>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.<br>***Examples:***<br>TRN_CUSTID$<br>"D"+FLD#2$(1,3)<br>PAD(Company$,5,$00$)+PAD(Department$,10,$00$)+STR(EmployeeNum)<br>KEY(\_\_fileFN,KNO=0,KEY=Company$:Department$:EmployeeNum)<br>***Multi-Segment Keys***<br>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:<br>PAD(Company$,5,$00$)+PAD(Department$,10,$00$)+STR(EmployeeNum)<br>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.<br>***Key Expression Builder***<br>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*.<br>![](https://manual.pvxplus.com/migration-assets/59e5a1c2a0678f1d413b7f7fffbba064b254bf18cda326938325777e49f59e02.png)<br>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.<br>In the case of ***multi-segment keys***, a *Generate a KEY=F1$:F2$ expression* check box option is available:<br>\|  \|  \|<br>\| --- \| --- \|<br>\| • \| If it is not selected, the key segments will be concatenated, and individual key segments would have to be padded or manipulated appropriately. \|<br>\| • \| 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](https://manual.pvxplus.com/data-dictionary/file-link-maintenance#multiseg_keys)**.) \|<br>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.<br>*(The Generate a KEY=F1$:F2$ expression check box was added in PxPlus 2023.)  <br>(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](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/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, use one of the following methods:

| **Location** | **Method** |
| --- | --- |
| From **File Link Maintenance** | Click the **[Link Express](https://manual.pvxplus.com/data-dictionary/file-link-maintenance#linkexpress)** button. |
| From **[Data Dictionary Maintenance](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/overview)** | On the Main panel, click the drop-down arrow on the **[Define File Links](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/overview#file_links)** button (*chain link with drop-down arrow*) and select *File Links Express* from the displayed menu.<br>*(The Define File Links button in Data Dictionary Maintenance was added in PxPlus 2025.)* |
| From **[Data Dictionary Maintenance](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/overview)** | From the *Utilities* menu, select *File Links Express.*<br>*(File Links Express was added to the Data Dictionary Utilities menu in PxPlus 2025.)* |

The **File Links Express** window is displayed:

![](https://manual.pvxplus.com/migration-assets/db4add5b70500b6083fb754929c30776c369a7df3ad3e377d010c27c355b8696.png)

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.<br>*(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:<br>\|  \|  \|<br>\| --- \| --- \|<br>\| *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. \|<br>\| *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*.<br>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. \|<br>\| *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. \|<br>\| *Prefix* \| Prefix to use for the record prefix of the *File to Link to*. \|<br>\| *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*.<br>Enter the Key expression in the grid or click the dotted button to invoke the **[Key Expression](https://manual.pvxplus.com/data-dictionary/file-link-maintenance#keyexpr)** utility. \|<br>\| *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.<br>*(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.<br>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)***<br>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.<br>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. |
