# Query Subsystem

> Source: https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/overview

The **NOMADS Query Subsystem** generates panels that display records from datasets and return a value associated with a record selected by the user. The selected value populates the control with which it is associated.

When defining a query, the element and key information can come from the **[Data Dictionary](https://manual.pvxplus.com/data-dictionary/introduction)**. The query is usually invoked via a *query* button, which can be associated with certain **[Panel Controls](https://manual.pvxplus.com/nomads-graphical-application/creating-panel-controls/introduction)** and appears next to ***single line*** Multi-Line controls at run time. A query can also be invoked by pressing **Shift + F2** or through program control.

The **Query Subsystem** has *three* modes of display: **[Query+](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/overview#queryplus)**, **[Drop Queries](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/overview#dropquery)** and **[Classic Query](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/overview#classicquery)** (original). The **Query+** mode is the *default* mode. An example of each display is pictured below.

In general, a query presents a panel with a list containing data from one or more linked files that can be filtered based on specified selection criteria. A toolbar and popup menu are available with options to do the following: copy or export columns, records or all the data, add dynamic filters to the data shown, designate certain records as favorites, hide and show selected columns, edit the data, or print the data. You can also match a value to the beginning of a selected column or key to place your focus in the data list, or you can search all the data for a specified value.

A query definition can also be used as the **[Input Source](https://manual.pvxplus.com/report-writer/designing-a-report/defining-the-data/input-source)** in Report Writer when determining the source of the data to display on a report.

*(The ability to use a query definition as a source for Report Writer reports was added in PxPlus 2020.)*

By default, a query has no security assigned to it. This means that all users can view all data that can be displayed by means of a Query Definition. Security can be added to the Query Definition through the NOMADS Security Manager by using security classifications to identify and control user access. For information on how to set up security for a query, see **[Query Security](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/query-security)**.

## Query+

The **Query+** display, which is the *default* mode, sorts by column. Advanced column sorting ignores case and accents, supports sort algorithms and can handle complex date sorting. Query+ includes the ability to resize and reorder the columns and to create new formulas at run time.

Query+ supports visual cues, such as bold and colored text, background highlight colors and images. It also supports the **[AutoChart](https://manual.pvxplus.com/nomads-autochart/introduction)** feature, which generates charts based on the query data. Query+ makes use of load-on-demand and background loading techniques to enhance performance.

The **[Query Profile](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/run-time-query#qryprofiles)** feature makes it convenient for end users to save run-time query settings, such as column order/width, filters and additional formulas, etc., so that the settings can be reloaded at a later time by selecting a named profile.

Three views are available that feature a toolbar ***(Default)***, a menu, or both.

*(The ability to save Query Profile settings was added in PxPlus 2019.)*

|  |  |
| --- | --- |
|  | ![](https://manual.pvxplus.com/migration-assets/a4071ed7c7dd4f421aaa7b9050073e364f047029cb47218d431f3387e9a9b729.jpg)  <br>***Query+*** |

## Drop Queries

**Drop Queries** are displayed directly on the current panel adjacent to their associated Multi-Line rather than on a separate panel like the other query types. These queries have no toolbar or *Select* button; however, many features of the Query+ are available via the right-click popup menu.

Note:  
Drop Queries are designed to display small datasets, as would be displayed in a drop box. These queries are *not* recommended for large datasets as the entire dataset is loaded when the query is invoked.

Two types of Drop Queries are available, ***Drop Query*** and ***Drop Tree***:

|  |  |
| --- | --- |
| *Drop Query* | Displays data in a Report View list box and emulates an enhanced Drop Box.<br>![](https://manual.pvxplus.com/migration-assets/918cc742ea0d67e3026532cd2b1c73bbc13d1f78c5d076677d2cc64529539468.png)<br>The Drop Query does not support the **[AutoChart](https://manual.pvxplus.com/nomads-autochart/introduction)** feature in its right-click popup menu.<br>*(Drop Query functionality was added in PxPlus 2014 - Feature Pack 1.)* |
| *Drop Tree* | Displays data using a Tree View display, which is useful when records can be grouped (e.g. like detail lines in an invoice).<br>![](https://manual.pvxplus.com/migration-assets/70b83495810d4a72e8ee1e2729d1648a2b03c29f01f5ed6bc4f21aa1aaa518c0.png)<br>The Drop Tree supports only the *Find*, *Refresh*, *Print*, *Filters* and *Profile* features in its right-click popup menu.<br>The Drop Tree does not support display options such as colors, images, percent bars, etc.<br>*(Drop Tree Query functionality was added in PxPlus 2021.)* |

Note:  
Drop Queries are only displayed as such if they are associated with a Multi-Line in the Multi-Line definition and invoked at run time via the query button. See [Assigning a Query](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/invoking-a-query#assigningquery).  
  
If a Drop Query is invoked programmatically with a [PROCESS](https://manual.pvxplus.com/directives/process) command, it will be displayed using the default Query+ format, as there is no associated control.

## Classic Query

The **Classic Query** sorts by key value but has an option to switch to column sorting. The *Sort by Column* option supports column sort algorithms. The Classic Query also supports column sub-queries.

|  |
| --- |
| ![](https://manual.pvxplus.com/migration-assets/226f41f497d99a5ed76c49c897e44346519f5d0b41a5156e14cd6736a76505b1.png)  <br>***Classic Query*** |

## Additional Query Information

Query datasets can be based on an existing **[Data Dictionary](https://manual.pvxplus.com/data-dictionary/data-dictionary-maintenance/overview)** definition, a **[PxPlus View](https://manual.pvxplus.com/views-system/introduction)**, an ODBC data source, or a manually defined file with no embedded dictionary. Query panels are built using element and key information from the Data Dictionary, View definition or ODBC data source. Column names, headings, widths, formats and associated sub-queries are derived from this information. If no data dictionary is available for the file being queried, then you must provide the element information.

***Query Subsystem Help***

The **Query Subsystem** Help provides detailed information on the following topics:

| **Topic** | **Description** |
| --- | --- |
| **[Defining a Query](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/defining-a-query):** | Explains the components for defining a query. |
| **[Query Header](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/query-header)** | Defines the main file or table for the dataset and the general characteristics of the query. |
| **[Query Definition](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/query-definition)** | Defines the contents of the query. This includes cross-reference files, columns and formulas. |
| **[Defining Query Column and Row Display](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/query-column-and-row-display)** | Explains how to assign visual attributes, such as bold text, text color or highlight color, to a query column or a row in the query data list based on specified conditions being met. |
| **[Query Security](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/query-security)** | Explains how security can be set up for a query. |
| **[Query Colors](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/query-colors)** | Explains how to customize the look of a query display using color settings and Themes. |
| **[Query Selection Criteria](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/query-selection-criteria)** | Defines selection criteria to filter the data. |
| **[Invoking a Query](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/invoking-a-query)** | Describes the various ways to invoke a query, as well as how to switch modes to Query+ or the Classic Query. |
| **[Run-Time Query](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/run-time-query)** | Describes the options available to the user at run time. |
| **[Service Queries for Web, Email, Map and Open File](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/service-queries-for-web-email-and-map)** | Explains the three service programs that are launched via the query interface:<br>\|  \|  \|<br>\| --- \| --- \|<br>\| *Web Query* \| Launches a website. \|<br>\| *Email Query* \| Launches an email window. \|<br>\| *Map Query* \| Launches a Google map. \|<br>\| *Open File* \| Launches a standardized file selection dialog. \|<br>*(The Open File Query was added in PxPlus 2020.)* |
| **[Designing and Using the Query Subsystem](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/query-subsystem/designing-and-using-the-query-subsystem)** | Describes design and interface considerations. |
| **Suppressing Query Persistence** | By default, when NOMADS **[Panel Persistence](https://manual.pvxplus.com/nomads-graphical-application/panel-designer/resizing-and-persistence/panel-persistence)** is turned ***On***, it affects all dialogue panels and queries. Panel persistence can be suppressed (for Query+ and Classic Query) on a ***system-wide*** basis by setting the **[%NOMADS'Query_Suppress_Persistence](https://manual.pvxplus.com/nomads-graphical-application/appendix/nomads-variables/overview#querysuppresspersistence)** property. The settings for this property are:<br>\|  \|  \|<br>\| --- \| --- \|<br>\| **0** \| *Do not suppress persistence* (if set) ***(Default)*** \|<br>\| **1** \| *Suppress persistence* (the location/size of the query will be the original location/size) \|<br>\| **2** \| *Suppress location persistence* (the location will be the original location, but size will persist if changed) \|<br>*(Support for suppressing panel and query persistence was added in PxPlus 2019.)* |

## See Also

**[How to Process Multiple Files with the Report Writer](https://manual.pvxplus.com/how-to/how-to-process-multi-files-with-report-writer)**
