Create, edit and manage queries
This topic explains how to create queries in NVivo—either by using the Query Wizard or by defining the criteria yourself. You can save the queries that you create in NVivo and run them again as your project develops. For example, you could create a Coding query to gather all the material coded at global warming combined with carbon emissions—you could run this query again as the content coded at these nodes grows.
What do you want to do?
- Create a query using the Query Wizard
- Create a query outside the Wizard
- Cancel the execution of a query
- Delete a saved query
- Edit the properties of a saved query
- Re-run a saved query
- Re-run the last query
Create a query using the Query Wizard
The Query Wizard steps you through the process of creating a new query. To create a query using the Wizard:
-
On the Query tab, in the Create group, click Query Wizard.
-
On the first screen of the Wizard, choose what you want to do (see below) and then follow the steps in the Wizard to create and run the query.
What do you want to do? | Description |
See where particular terms occur in content |
This is a Text Search query. When you create a Text Search query using the Wizard you can:
You can choose to search text in all your sources, or restrict the search to selected items or folders. Refer to Run a Text Search query for more information. |
Identify frequently occurring terms in content |
This is a Word Frequency query. When you create a Word Frequency query using the Wizard, you can:
You can choose to count words in all your sources, or restrict the count to words in selected items or folders. Refer to Run a Word Frequency query for more information. |
Search for content based on how it is coded |
This is a Coding query. When you create a Coding query using the Wizard, you can:
You can choose to look for coded content in all your sources, or restrict the query to selected items or folders. Refer to Run a Coding query for more information. |
Cross-tabulate how content is coded |
This is a Matrix Coding query. When you create a Matrix Coding query using the Wizard, you must choose what you want to show in the rows and columns of the matrix. Matrix Coding queries often show nodes in both the rows and columns, but you can also select sources, sets or Search Folders. You can select specific sources or nodes to show as the rows and columns or select content that particular attribute values or meets attribute value conditions (.e.g. age > 40). Here are some examples showing how you can use Matrix Coding queries:
You can choose to create the matrix based on coding in all your sources, or restrict the query to selected items or folders. Refer to Run a Matrix Coding query for more information. |
Create a query outside the Wizard
If you are familiar with NVivo queries (or want to use features that are not available in the Wizard), you can create queries outside the Wizard. Some types of queries cannot be created with the Wizard—for example, Compound and Coding Comparison queries.
To create a query outside the Wizard:
-
On the Query tab, in the Create group, click the icon for the query you want to create.
-
Set up the query as shown below:
a Use the Criteria tab to define the criteria for the query—what are you looking for and where do you want to look?
b (Optional) Select the Add To Project check box to save the query—this means you can easily run the query again. By default, queries are stored in the Queries folder. You can create your own folders for queries and organize them to suit your project.
c Use the General tab to name and describe the query if you choose to save it—this tab is only available when you select the Add to Project check box.
d (Optional) Use the Query Options tab to set options for your query results. For example, you might want to store the results in a node within your project, or spread coding to surround content. This tab is only available for Text Search, Coding, Compound and Matrix Coding queries.
e Click Run.
Refer to the following topics for detailed information on creating different types of queries:
|
Cancel the execution of a query
You can cancel a query if it is taking too long to run or you want to revise the criteria.
To cancel the query:
-
Click the red cancel button beside the progress bar that is displayed at the bottom of the window when the query is running.
Delete a saved query
-
In List View, select the query you want to delete.
-
On the Home tab, in the Editing group, click Delete.
Edit the properties of a saved query
-
In List View, select the query you want to edit.
-
On the Home tab, in the Item group, click the Properties image.
The dialog box for the selected query opens.
-
Change the query properties as required:
-
In the General tab, change the name or description.
-
In the Criteria tab, change the query criteria.
-
In the Query Options tab, change the results options—refer to Query options for more information.
-
Click OK.
Re-run a saved query
When you set-up and save a query, you can re-run it as your project progresses. For example, you might run the same coding query every month.
-
In the List View, click the query you want to re-run.
-
On the Query tab, in the Actions group, click Run Query.
Re-run the last query
You can open the most recent query (even though you may not have saved it in your project) and run it again.
-
On the Query tab, in the Actions group, click Last Run Query.
The properties of the most recent query are displayed.
-
Click Run.
NOTE You can only run the most recent query for the current session. If you close NVivo, the last run query is not available when you re-open the application.