# Data Classes

Extended Class Validation and Display |

Extended Validation is used to provide additional table validation and allow access to data elements for creating display-onlyMulti-Line controls when designing NOMADS panels. At run time, when a valid value is entered, the Extended Validation Multi-Line controls are populated with existing data from the table.

To define Extended Validation, access the Validation tab for a Multi-Line Data Class.

See the tutorial How to Use Extended Class Validation and Display.

#### Note:
Extended Validation is defined only for Multi-Line data classes that are Dynamic. For information on creating a dynamic data class, see Dynamic Control Properties.

When working with Grids in the NOMADS Panel Designer, a data class can be assigned in Grid Presets Definition by selecting the Class property. If assigning a Multi-Line data class that has Extended Validation, additional table validation will be provided at run time when a value is entered.

(Extended Validation was added in PxPlus 2019.)
(Support for Extended Validation in Grids was added in PxPlus 2019 Update 1.)

The following two examples include detailed steps on how to define Extended Validation and how it is subsequently used with Multi-Line and Grid controls when designing a NOMADS panel.

| Example: Extended Validation (Multi-Lines)
| Example: Extended Validation (Grids)

Both examples use the Sales Rep table, which consists of the data elements below.

| Sales Rep Table: Data Elements

## Example: Extended Validation (Multi-Lines)

This example includes the following steps for defining Extended Validation, creating Multi-Line controls and viewing run-time examples of a NOMADS panel:

- Step 1: Create a dynamic Multi-Line data class with Extended Validation.
- Step 2: Create a Multi-Line control with the Extended Validation data class. This control will be used to enter the value to validate.
- Step 3 and Step 4: Create additional display-only Multi-Line controls from other table data elements. These controls will be populated when a valid value is entered.
- Step 5: Panel recap that shows all the Multi-Line controls created in this example.

#### Note:
In the File Maintenance Generator, the Fields list will display Extended Validation descriptive fields (i.e. SHOW.xxxxxx) only if this functionality was defined for a corresponding data element that is also part of a key with more than one segment. When displayed, the descriptive fields can be easily added to the layout grid for the panel being generated. See Extended Validation Descriptive Fields (SHOW.xxxxxx).

To begin:

Step 1: Create a Multi-Line Data Class with Extended Validation

In Data Class Definitions maintenance, create a Multi-Line data class. Name it SALESCD and select the Dynamic check box.

On the Validation tab, select the Use Extended Validation check box. Enter the Extended Validation settings below.

| "SALESCD" Data Class with Extended Validation

Step 2: Create a Multi-Line Control with the Extended Validation Data Class

In Step 1, SalesrepKey: Sales Rep Code was selected for the Key. This is the value to be validated.

On the NOMADS panel, create a Multi-Line control with the Extended Validation data class. Name the Multi-Line control SALES and for the Class, enter SALESCD.

| "SALES" Multi-Line "SALES" Multi-Line with Extended Validation Data Class "SALESCD"
| #### Note: On the Validation tab, the dynamic values for Validator and Formatter differ from the "standard" dynamic values. Because Extended Validation was defined in the SALESCD data class, these values allow the code to automatically validate the entry and correctly format it at run time.
| Run-Time Example: Sales Rep Code Validation

Step 3: Create a Multi-Line Control for the Descriptive Field

In Step 1, Name$ was selected for the Descriptive Field. This allows the Name data element to be available when designing the panel.

On the same panel, draw another Multi-Line control. Name it SHOW.SALES. This Multi-Line control will automatically display the Salesperson's Name when a valid Sales Rep Code is entered.

| SHOW.SALES Multi-Line |
| #### Important Note: When creating a Multi-Line control for the Descriptive Field, the Multi-Line Name must have the following format: SHOW.name.element
| SHOW.SALES Multi-Line Run-Time Example: Validation with Salesperson Name Displayed |

Step 4: Create Multi-Line Controls for Other Data Elements

In Step 1, the Populate All Fields check box was selected. This allows all data elements to be available when designing the panel.

On the same panel, draw Multi-Line controls for the three data elements below, using the names provided. These Multi-Line controls will automatically populate with data when a valid Sales Rep Code is entered.

| Data Element | Multi-Line Control Name
| Department$ | SHOW.SALES.DEPARTMENT
| ytdOrders | SHOW.SALES.YTDORDERS
| ytdSales | SHOW.SALES.YTDSALES
#### Note: The Multi-Line control Name must correspond with the name given to the element in the data dictionary.
| Multi-Lines for Other Data Elements |
| SHOW.SALES.DEPARTMENT Multi-Line SHOW.SALES.YTDORDERS Multi-Line SHOW.SALES.YTDSALES Multi-Line |
| Run-Time Example: Validation with Department, YTD Orders and YTD Sales Populated |

Step 5: Panel Recap

The end result is a panel created with the following Multi-Line controls for Extended Validation:

To make it easier to create Multi-Line controls for Extended Validation data elements, the Extended Class Browse can be used. It shows a list of all the table data elements that can be added to a panel. When a data element is selected, the appropriate Multi-Line properties, including the Name, are defined.

| Extended Class Browse: Department Data Element Selected |  | Multi-Line Properties: SHOW.SALES.DEPARTMENT

## Example: Extended Validation (Grids)

This example includes the following steps for defining Extended Validation, adding the Extended Validation data class to a Grid and viewing run-time examples of a NOMADS panel:

- Step 1: Create a dynamic Multi-Line data class with Extended Validation.
- Step 2: Add the Extended Validation data class to Grid Presets Definition and then specify the column, row or cell to be used for entering the value to be validated.

To begin:

Step 1: Create a Multi-Line Data Class with Extended Validation

If desired, a new Multi-Line data class can be created by following Step 1 of the above example.

Since a Multi-Line data class (SALESCD) with Extended Validation was previously created, it will be used for this example. Proceed to Step 2.

| "SALESCD" Data Class with Extended Validation

Step 2: Add the Extended Validation Data Class to Grid Presets Definition

When SALESCD was created, SalesrepKey: Sales Rep Code was selected for the Key. This is the value to be validated.

On the NOMADS panel, create a new or select an existing Grid control. In the Grid Properties dialog, select the Presets tab.

In the Property column, select Class from the drop-down list. Specify the desired Column/Row that will be used to enter the value to be validated. In the Value/Expression column, select the SALESCD class from the query.

| Run-Time Example: Valid Sales Rep Code Entered Run-Time Example: Invalid Sales Rep Code Entered

## See Also

Populate from Data Source
File Maintenance Generator