Data Classes

Populate from Data Source (Drop Boxes and List Boxes)

When creating data classes for Drop Boxes and List Boxes, a Load From File check box (on Display tab) can be selected, which allows a data table/file to be defined as the source when populating a Drop Box or List Box at run time.

 


Drop Box Data Class: Load From File


List Box Data Class: Load From File

Note:
The Load From File check box is available only when defining Dynamic data classes for Drop Boxes and List Boxes. 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 added in Grid Presets Definition by selecting the Class property. If adding a Drop Box or a List Box data class that is defined with Load From File functionality, at run time, the cell will be created as a Drop Box populated from the pre-defined data source.

(The Load From File check box was added in PxPlus 2019.)

The following five examples include detailed steps on how to define the Load From File functionality for Drop Box and List Box data classes, as well as how this functionality is subsequently applied when a NOMADS panel is run.

 

Example: Load From File (Drop Box)

 

Example: Load From File (List Box)

 

Example: Load From File (Other List Box Types)

 

Example: Load From File (Drop Box Class Added to Grid)

 

Example: Load From File (List Box Class Added to Grid)

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

 


Sales Rep Table: Data Elements

Example: Load From File (Drop Box)

This example includes the following steps for defining the Load From File functionality for a Drop Box data class and viewing run-time examples of a NOMADS panel:

To begin:

Step 1: Create a Drop Box Data Class with the Load From File Option

In Data Class Definitions maintenance, create a Drop Box data class. Name it SALESDB and select the Dynamic check box.

On the Display tab, select the Load From File check box. Enter the Load From File settings below.

 


"SALESDB" Data Class with Load From File

Step 2: Create a Drop Box Control with the Load From File Data Class

In Step 1, SalesrepKey: Sales Rep Code was selected for the Key. This value will be used when populating the Drop Box.

On the NOMADS panel, create a Drop Box control with the Load From File data class. Name the Drop Box control SALESCODE and for the Class, enter SALESDB.

 


"SALESCODE" Drop Box


"SALESCODE" Drop Box with Load From File Data Class "SALESDB"

Step 3: Run the Panel

In Step 1, the following Load From File settings were selected:

 

Key

SalesrepKey: Sales Rep Code

 

Display Value

Name$

 

Include Key and Value

On

At run time, the Drop Box control is populated with data from the Sales Rep table. The values displayed include Sales Rep Code and Name$, separated by a : (colon) and two spaces.

 


Run-Time Example: Sales Rep Code + Name

Note:
For multi-part keys that are displayed in the Drop Box values, any Hex null characters are translated to spaces.

If the Include Key and Value check box is Off, then the values displayed will consist of Name$ only.

 


Run-Time Example: Name Only

If Display Value is blank, then the values displayed will consist of Key values only.

 


Run-Time Example: Key Values Only

These run-time examples demonstrate how changing certain settings can affect the values displayed in the Drop Box. When a record is selected, the value returned is based on the Return Value, which was specified as SalesrepKey for this example. This consists of the Sales Rep Code (e.g. AN).

Example: Load From File (List Box)

This example includes the following steps for defining the Load From File functionality for a List Box data class and viewing run-time examples of a NOMADS panel:

To begin:

Step 1: Create a List Box Data Class with the Load From File Option

In Data Class Definitions maintenance, create a List Box data class and for the List Box Type, select Report View. Name it SALESLB and select the Dynamic check box.

On the Display tab, select the Load From File check box. Enter the Load From File settings below.

 


"SALESLB" Data Class with Load From File

Step 2: Create a List Box Control with the Load From File Data Class

In Step 1, SalesrepKey: Sales Rep Code was selected for the Key. This value will be used when populating the List Box.

On the NOMADS panel, create a List Box control with the Load From File data class. Name the List Box control SALESCODE and for the Class, enter SALESLB.

 


"SALESCODE" List Box


"SALESCODE" List Box with Load From File Data Class "SALESLB"

Step 3: Run the Panel

In Step 1, the following Load From File settings were selected:

 

Key

SalesrepKey: Sales Rep Code

 

Display Value

Name$

 

Include Key and Value

On

At run time, the List Box (Report View) control is populated with data from the Sales Rep table. The values displayed include Sales Rep Code and Name$ in two separate columns using the column headers from the table.


Run-Time Example: Sales Rep Code + Name

Note 1:
When determining the format for Report View List Boxes, column widths are determined by taking the higher value between the data size and the header size.

Note 2:
For multi-part keys that are displayed in the List Box values, any Hex null characters are translated to spaces.

If the Include Key and Value check box is Off, then the values displayed will consist of Name$ only.

 


Run-Time Example: Name Only

If Display Value is blank, then the values displayed will consist of Key values only.

 


Run-Time Example: Key Values Only

These run-time examples demonstrate how changing certain settings can affect the values displayed in the List Box. When a record is selected, the value returned is based on the Return Value, which was specified as SalesRepNameKey (this is not the primary key) for this example. This consists of the Name + Sales Rep Code and may contain Hex null characters (e.g. Andrew Newman AN). Returning a key other than the Primary key may be advantageous if it is useful to know other values that may be passed out of the key value.

Example: Load From File (Other List Box Types)

The examples below show List Box results that were produced when the same Load From File selections (see Example: Load From File (List Box) were used to define new List Box data classes for other List Box Types (i.e. Standard, Formatted, List View, Tree View).

Note:
When defining List Box data classes, the List Box Type cannot be changed once the data class definition is saved. If the preference is to use an existing Class Name, delete the existing definition before creating a new one with the same name.

Example: Load From File (Drop Box Class Added to Grid)

This example includes the following steps for defining the Load From File functionality for a Drop Box data class, adding this data class to a grid and viewing run-time examples of a NOMADS panel:

To begin:

Step 1 : Create a Drop Box Data Class with the Load From File Option

If desired, a new Drop Box data class can be created by using the steps in the Example: Load From File (Drop Box).

Since a Drop Box data class (SALESDB) with the Load From File option was previously created, it will be used for this example. Proceed to Step 2.

Step 2: Add this Load From File Data Class to Grid Presets Definition

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 is to contain the Drop Box to be populated. In the Value/Expression column, select the SALESDB class from the query.

 


Grid Presets with Load From File Data Class "SALESDB"

Step 3 : Run the Panel

In Step 1, the following Load From File settings were selected:

 

Key

SalesrepKey: Sales Rep Code

 

Display Value

Name$

 

Include Key and Value

On

At run time, the Drop Box is populated with data from the Sales Rep table. The values displayed include the Sales Rep Code and Name$, separated by a : (colon) and two spaces.

 


Run-Time Example: Sales Rep Code + Name

If the Include Key and Value check box is Off, then the values displayed will consist of Name$ only.

 


Run-Time Example: Name Only

If the Display Value is blank, then the values displayed will consist of Key values only.

 


Run-Time Example: Key Values Only

These run-time examples demonstrate how changing certain settings can affect the values displayed in the Drop Box. When a record is selected, the value returned is based on the Return Value, which was specified as SalesrepKey for this example. This consists of the Sales Rep Code (e.g. AN).

Example: Load From File (List Box Class Added to Grid)

This example includes the following steps for defining the Load From File functionality for a List Box data class, adding this data class to a grid and viewing run-time examples of a NOMADS panel:

Note:
When adding a List Box data class with Load From File functionality to a grid, the cell will be created as a Drop Box (rather than a List Box) and populated at run time from the pre-defined data source.

To begin:

Step 1 : Create a List Box Data Class with the Load From File Option

If desired, a new List Box data class can be created by using the steps in the Example: Load From File (List Box).

Since a List Box data class (SALESLB) with the Load From File option was previously created, it will be used for this example. Proceed to Step 2.

Step 2: Add this Load From File Data Class to Grid Presets Definition

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 is to contain the Drop Box to be populated (see Note above). In the Value/Expression column, select the SALESLB class from the query.

 


Grid Presets with Load From File Data Class "SALESLB"

Step 3 : Run the Panel

In Step 1, the following Load From File settings were selected:

 

Key

SalesrepKey: Sales Rep Code

 

Display Value

Name$

 

Include Key and Value

On

At run time, the Drop Box is populated with data from the Sales Rep table. The values displayed include the Sales Rep Code and Name$, separated by a : (colon) and two spaces.

 


Run-Time Example: Sales Rep Code + Name

If the Include Key and Value check box is Off, then the values displayed will consist of Name$ only.

 


Run-Time Example: Name Only

If the Display Value is blank, then the values displayed will consist of Key values only.

 


Run-Time Example: Key Values Only

These run-time examples demonstrate how changing certain settings can affect the values displayed in the List Box. When a record is selected, the value returned is based on the Return Value, which was specified as SalesRepNameKey (this is not the primary key) for this example. This consists of the Name + Sales Rep Code and may contain Hex null characters (e.g. Andrew Newman AN). Returning a key other than the Primary key may be advantageous if it is useful to know other values that may be passed out of the key value.

See Also

Extended Class Validation