Creating a Combined Query for items in a module
Who is this article for?Users who want to understand how to build Combined Queries.
Access_Queryor higher permissions are required
Combined Queries take the results of a Query and add, intersect, or remove results from other Queries depending on which option you select. This guide will take you through the steps you need to build a Combined Query of your own.
In this article:
1. Building a Combined Query
Before you start, there are two important rules to remember:
- You can't combine more than five Queries.
- You can't combine a Combined Query with other Queries.
To set up a Combined Query, add a 'Combine with other Queries' filter to a Query. Next sections will walk you through what each available option can help you achieve.
Include the Results Of
This operation will take the results of the current Query and add the results of the selected Query.
For example, take all PIs at 'Red' status and add all PIs that are due for update.
To create this Combined Query:
- Create a PI Query for all items due for update.
You can do this by selecting 'Relative Dates' > 'Next Update Due Date'. Set the 'Days' value to whatever period you want to cover. - Create a PI Query to find all PIs at 'Red' status.
- You can do this by selecting 'Performance' > 'Status' > 'Alert'.
- Add the 'Combine with other Queries' filter to your second Query.
When prompted to add a Query, search for the first Query you set up. Be sure to select the 'Include the results of' operation.
When run, you can see that the PIs at 'Red' status are found, and the PIs that are due for update are added to the results, including a 'Green' one.
Intersect with the Result Of
This operation will take the results of the current Query and only show those that also appear in the results of the selected Query.
For example, take all PIs at 'Red' status and only show those that are due for update.
To create this Combined Query:
- Create a PI Query for all items due for update.
You can do this by selecting 'Relative Dates' > 'Next Update Due Date'. Set the 'Days' value to whatever period you want to cover. In this example, two of the results are 'Red' and one is 'Green'. - Create a PI Query to find all PIs at 'Red'.
- You can do this by selecting 'Performance' > 'Status' > 'Alert'.
- Add the 'Combine with other Queries' filter to your second Query.
When prompted to add a Query, search for the first Query you set up. Be sure to select the 'Intersect with the results of' operation.
When run, you can see that the two PIs shown have 'Red' status and are due for an update. This is because the results of this Query are being taken and compared against the 'All PIs due for update' Query, removing the 'Green' result.
Remove the Results Of
This operation will take the results of the current Query and remove the results of the selected Query.
For example, find PIs that have a 'Red' status and are due for update.
To create this Combined Query:
- Create a PI Query for all items due for update.
You can do this by selecting 'Relative Dates' > 'Next Update Due Date'. Set the 'Days' value to whatever period you want to cover. In this example, two of the results are 'Red' and one is 'Green'. - Create a PI Query to find all PIs at 'Red'.
- You can do this by selecting 'Performance' > 'Status' > 'Alert'.
- Add the 'Combine with other Queries' filter to your second Query.
When prompted to add a Query, search for the first Query you set up. Be sure to select the 'Remove the results of' operation.
When run this, you can see that only one PI is being shown. This PI has a 'Red' status and is not due for update. This is because the results of this Query are being taken and compared against the 'All PIs due for update Query'. Any PI that is found in both Queries is removed.