---
title: "Create a query"
id: "create-a-query"
project: "EHR User Guide"
url: "https://help.cloud5.com.au/articles/ehr-user-guide/create-a-query"
updated: 2026-10-19T00:54:09Z
---

# Create a query

Here is how to create a query - selecting data for the query, sorting, filtering and grouping the data, to get the best results.

## Select data![](/resources/Storage/ehr-user-guide/ehr-user-guide/icons/desktop%20icon.png) 

To select fields and add them to the **Query data** panel:

1. Go to **Enquiries** &gt; **Query Manager**.
2. At the **Data** tab, do either of the following to locate the field you want:
    1. In the **Search** box, enter the criteria you want to search on, and then click **Search**. At the **Field Search Results** screen, double-click the field you want. EmpowerHR locates and selects the field in the **Catalogue** panel, *or*
    2. Expand the folders in the **Catalogue** panel until you locate the field you want, and then click it to select it
3. Add the field to the **Query data** panel by doing either of the following:
    1. click **Move Right**, *or*
    2. double-click the field
4. Repeat this procedure until you've added all the fields you want to use in the query.
5. If you select any field just for filtering purposes, you can stop it appearing in the data the query returns (and displays in the query results window) by clearing the display field checkbox that immediately precedes the field name in the **Query data** panel.
6. To change the order of fields in the **Query data** panel, select a field name and then click and drag it to where you want it to appear in the field list.
7. See the following procedure for how to sort the data you selected for the query.

## Sort data![](/resources/Storage/ehr-user-guide/ehr-user-guide/icons/desktop%20icon.png) 

Use the following procedure to define the sort order of data in the output results.

To set the sort order:

1. In the **Q** **uery data** panel, click the sort field icon that appears between the display field checkbox and the field name.
2. Each time you click the sort field icon, it cycles through sort ascending (up arrow), sort descending (down arrow), and unsorted (no arrow) states.
3. When you run the query, EmpowerHR displays the output results sorted in the order you've chosen.

## Filter data![](/resources/Storage/ehr-user-guide/ehr-user-guide/icons/desktop%20icon.png) 

You can apply filtering to restrict the data returned by a query.

Query Manager:

* offers standard (pre-defined) data filters. See [standard filters](/articles/ehr-user-guide/standard-filters) for a list of many of EmpowerHR's pre-defined data filters.
* provides system parameters. These are filters that automatically prompt you to select data when you run the query. See [standard parameters](/articles/ehr-user-guide/standard-parameters) for a list of pre-defined system parameters.
* allows you to add your own user-defined data filters and system parameters.  See [advanced query manager](/articles/ehr-user-guide/advanced-query-manager) for instructions.

To filter data:

1. As you select the fields from the **Catalogue** panel on the **Data**tab, Query Manager automatically constructs a set of recommended filters.
2. Click **Filter**.
3. EmpowerHR displays the **Filter** tab, listing:
    1. available standard filters in the **Predefined filters** panel
    2. any recommended filters in the **Recommended/Selected filters** panel
4. A recommended filter initially displays with a red funnel requiring selection, or a frequently used optional filter displays with a grey funnel. See the following table for the meaning of the filter icons.

| **Icon** | **Meaning** |
| --- | --- |
| Green filter (funnel) | Selected filter |
| Red filter (funnel) | Unselected filter |
| Grey filter (funnel) | Frequently used filter |
| Match filter (a = b) | System parameter automatically prompting you to enter selection criteria when you run the query.<br><br>For example: Employee Code |
| Element filter | Filter based on the Leave or Payment Code defined by the selected element.<br><br>For example: Leave Accrual Pay Codes |

1. To select a filter, click the filter icon. When you select a filter that satisfies a particular set (for example, restriction on employees), EmpowerHR greys out any other filters within the set to indicate the recommendation is satisfied, and sets the selected filter to green.

| ![Information](/resources/Storage/ehr-user-guide/ehr-user-guide/Info.png) | Unless all recommended filter sets are satisfied, when you run the query, EmpowerHR displays a warning message and prompt. |
| --- | --- |

1. If you want to further restrict data, you can:
    1. select additional filters from those recommended, *or*
    2. add filters from the filter catalogue by selecting the filter and clicking **Move Right**

## Group/total data![](/resources/Storage/ehr-user-guide/ehr-user-guide/icons/desktop%20icon.png) 

Grouping data allows you to aggregate or summarise data according to common characteristics. Query Manager offers a range of aggregate functions to help you gain valuable insights from large datasets, making data analysis more manageable and informative.

Query Manager supports the following aggregation functions, which are available when you click the define aggregate function icon displayed beside each field in the **Query data** panel on the **Data** tab.

* Sum
* Count
* Average
* Minimum
* Maximum

| ![Information](/resources/Storage/ehr-user-guide/ehr-user-guide/Info.png) | With the exception of calculated fields, Query Manager automatically applies the group clause to any non-aggregate (and non-literal) fields. See [use calculated fields](/articles/ehr-user-guide/use-calculated-fields) for the grouping actions available for calculated fields. |
| --- | --- |

| Next topic<br><br>[Standard filters](/articles/ehr-user-guide/standard-filters) |
| --- |

© 2023 Fusion5. All rights reserved.