# View Maintenance

Define a View |

The Define a View window is used for creating customized views from a selected data source. Once a descriptive View Name is entered, the sort criteria (access key) and elements (fields) to include in the view can be selected.

This window also provides the ability to:

- Define calculated items.
- Assign views to logical groups.
- Set up record selection criteria.
- Include logic procedures.
- Add password protection.
- Preview a sample of the data that will be returned by the current view.

(The ability to define calculated items was added in PxPlus 2021.)

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

Location | Method
From Data Source Maintenance | Select the data source to be used and click the Create View tool bar button. Another method is to right click on the data source and select Create a View from this Data Source from the popup menu.
From View Maintenance | Double click to expand the group containing the data source to be used. Then do either of the following: • Right click on the data source and select Create a View from this Data Source from the popup menu. OR • Double click on the data source, and when prompted, respond Yes to create a new view from this data source. Another method is to right click on an existing view and select Add a New View from the popup menu. When prompted, select the data source from which to create the view.

This window consists of the following:

(Elements List) | Displays a tree view list of the elements in the selected data source and its relationships, if applicable. This list is used to select the elements to include for the view definition. Select (or deselect) individual elements by double clicking the check box beside an element. To select all elements in a particular data source or relationship, right click on the data source or relationship name in the list and choose Select All elements in xxxxxxx from the popup menu (where xxxxxxx is the data source or relationship name). To enter a new name for the column, select the check box beside the element and then right click on the element and select Change column name from the popup menu. When prompted, enter a new name for the column. Maximum 60 characters.
Save | Button used to save a new view definition or save any changes to an existing view.
View Data | Button used to display a sample of the data that will be returned by the current view. Any changes to the view definition must be applied using the Save button before viewing the data.
Calc Items | Button used to invoke the Define Calculated Items window for defining expressions that can combine fields from different data sources. Any calculated items that are created can then be selected to display in the view. (The Calc Items button was added in PxPlus 2021.)
Filters | Button used to invoke the Define Filters window for assigning a filter for any element that has been included in the view definition. Also available as a selection on the popup menu when right clicking on an element.
Groups | Button used to invoke the Assign View: xxxxxxx to Groups window (where xxxxxxx is the view name) for assigning the current view to, or removing the current view from, existing groups.
Logic | Button used to invoke the Logic Procedures window for specifying the logic procedures to be performed at various levels in the definition and/or execution of a view.
Lock | Button used to invoke the Password Change window for locking the view with an optional password to control modification.
Security | Button used to invoke the Object Security Definition window for restricting or allowing user access to the view. For information on setting up security, see Security Manager.
Alphabetic Sort | Check box used to indicate how the elements within the data source tree view are to be displayed. By default, elements are displayed in the order in which they are defined in the data source definition. Selecting the Alphabetic Sort option displays elements alphabetically by description within the data source and each relationship. The order of the elements in the tree view is carried through to the order of the elements within the view definition, except for calculated items, which are always processed in their defined order regardless of how they are displayed in the tree view.
Rename | Invokes the Change Column Name window for entering a new name for the selected element/column (indicated by a check mark). Also available as a selection on the popup menu when right clicking on a selected element/column.
View Name | Assigns a unique descriptive name to identify the view. Maximum 64 characters.
Sort by | Indicates which key is to be used to access the view in a particular sorted order.
Comments | Description or comments related to the selected view, up to 255 characters in length. If a new view is defined, the comments from the associated data source will be loaded into the multi-line as the default comment.
Last Update | Indicates when the selected view was last updated and by whom.

#### Note:
Once a linked item is selected to be part of a view, changing the prefix for the relationship in the data source definition will not affect the name of the item.
To change the name of the linked item, you must deselect it from the view (which changes the name to the new prefix + item name), then select it again, or use the Change column name popup menu option and enter a new name.

In addition, if a selected element has a column name that exceeds 60 characters (due to nested prefixes), the column name would have to be changed.