Key Expression |
Enter a PxPlus expression consisting of any combination of variables from the panel, fields from accessible files, global variables, and/or literal values that may be concatenated to create the key value to read the record to retrieve the required data. A key expression may be string or numeric.
Examples:
TRN_CUSTID$
CustomerNum
"D"+FLD#2$(1,3)
%COMPANY_CODE$+CLIENT_CODE$
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.) (The ability to define numeric keys and multi-segment keys for an EZLoad Multi-Line was added in PxPlus 2023 Update 1.) |
Additional Fields |
(Available when Display Field is selected)
Button that invokes the EZ Load Additional Fields Definition dialog.
This dialog is used to specify additional Multi-Line controls on the same NOMADS panel that will be populated with data read from the selected Lookup Table using the same Key Expression.
For example, a Multi-Line for entering Product Codes is defined on a NOMADS panel. To display the Product Description when a Product Code is entered, a second Multi-Line can be defined with EZ Load functionality to read the Product table and retrieve that data. To display other fields, such as Price, Standard Cost and Quantity on Hand, from the same Product table record, additional Multi-Lines are created. Instead of defining these Multi-Lines with their own EZ Load definitions, they can be defined as EZ Load Additional Fields by associating them with the EZ Load definition on the Product Description Multi-Line. This allows other Multi-Lines on the same panel to use data from the same Lookup Table record, eliminating the need for multiple EZ Load definitions.
This dialog consists of the following:
File Information |
Displays the selected Lookup Table and Display Field. |
Screen Controls |
Click the drop-down arrow for a list of existing Multi-Line controls on the current NOMADS panel. This list does not include the actual EZ Load Multi-Line since it has already been defined on the main EZ Load Multi-line Definition dialog.
Multi-Line controls that are not yet defined on the NOMADS panel may also be manually entered. |
Field Expression |
(Available when a Screen Control is entered)
Click the drop-down arrow for a list of fields from the selected Lookup Table. The Field Expression is usually the name of the field; however, it may also be any expression derived from constants and/or variables known at run time. |
Delete Row(s) |
Grid-side button used to delete any row(s) no longer required. |
Auto Allocate |
If the Multi-Lines on the NOMADS panel have been named to match the field names from the Lookup Table, use the Auto Allocate button to auto populate the grid. Note: Only controls and fields of the same type (numeric/string) will be matched by the Auto Allocate button. |
OK |
Saves the additional fields entered in the grid and returns to the EZ Load Multi-line Definition dialog. The Additional Fields button will display a check mark to indicate that additional fields have been defined. Any rows that do not have a Field Expression entered will not be saved. |
Cancel |
Exits the EZ Load Additional Fields Definition dialog without saving any changes. |
(The Additional Fields button and EZ Load Additional Fields Definition dialog were added in PxPlus 2020.) |