Searching in RT Using Query Builder
The Query Builder feature in RT is a comprehensive search tool that lets you construct and modify searches, save searches, and share saved searches with other RT users.
This guide covers how to use Query Builder:
- Overview of searching
- Constructing a search
- Guidelines for combining search criteria
- Creating your search criteria
- Searching on date fields
- Running the search
- More options
- Modifying search criteria
- Formatting search results
- Saving searches
- Using saved searches
- Deleting saved searches
Overview of searching
The basic steps for creating and running a query are:
- Click on Tickets > New Search to get to Query Builder.
- Choose your search criteria.
Constructing searches
You can create simple or complex searches and specify any of the RT ticket fields, including any custom fields you use. You can also specify the use of "and" or "or" to combine search terms.
Guidelines for building a search
Bear in mind the following:
- The more terms you use, the narrower your results will be.
- Combining terms with "and" means the results have to meet both terms; combining with "or" means results only need to meet one or the other term.
- You can use both "and" and "or" in one search query but make sure the syntax is correct. For example, if you want to find tickets that have the status of either New or Open and were submitted by jdoe, the syntax needs to be (New or Open) and jdoe, not New or Open and jdoe.
Creating search criteria
- Go to Ticket Search > New Query.
Result: The Query Builder screen displays:
Example of the default Ticket Search screen.
If your queue contains custom fields, they will appear in the Add Criteria section.
The four areas, Add Criteria, Query, Display Columns and Saved Searches can be collapsed or expanded by clicking on the X to the left of the title.
If you previously clicked your queue name under Quick Search on the Home page, you'll see search criteria already entered Query Untitled Search area. - Use the dropdown lists and text boxes under Add Criteria to construct your search. For a complete list of the default fields and the corresponding dropdown list, go to the List of RT Ticket Fields.
- Specify the field(s) and value(s) you want to use in your search. If you want to fine tune the search (i.e., add and remove items) click Add then use the Query area to modify your search.
Note: If your queue uses custom fields, first choose your Queue from the dropdown list, then click Add in order to see your custom fields display. - If your search criteria requires the use of both and and or click on Advanced, modify the search logic, then click Apply.
- Specify the field(s) and value(s) you want to use in your search. If you want to fine tune the search (i.e., add and remove items) click Add then use the Query area to modify your search.
Searching on date fields
Date fields can be searched in various ways. To search on a specific date, the common date formats are recognized:
- MM/DD/YYYY (e.g. 10/25/2006)
- MM/DD/YY (e.g. 10/25/06)
- MM/DD (e.g. 10/25) - assumes current year
- DD-Mon-YY (e.g. 10-Oct-06)
- DD-Mon (e.g. 10-Oct) - assumes current year
In addition, relative date and time searches are supported:
- today
- yesterday
- 3 days ago
- -3 days (same as 3 days ago)
- 4 hours ago
Examples of Date Search Criteria
- To find tickets created before September 1, 2006, use the criterion: Created | Before | 9/1/2006
- To find tickets created today: Created | On | today
- To find tickets updated in the last four days: Last Updated | After | 4 days ago
Running the search
Run the search by clicking the Search button.
Result: The results display in a list with a default set of columns. With the results you can do the following:
- Make bulk updates by clicking on the Update Multiple Tickets link at the bottom of the results list.
- Export the results to an Excel spreadsheet by clicking on the Spreadsheet link at the bottom of the list.
More options
Modifying search criteria
Use the Query area to modify your search by selecting portions of your criteria and clicking on a button:
Button | Purpose |
---|---|
Moves selected line above preceding line | |
Moves selected line below the following line | |
Moves selected criteria to the left | |
Moves selected criteria to the right | |
Delete selected text | |
Clear the Query window | |
Change the selected "and" or "or" to the opposite |
Formatting search criteria
Before running a search, you can modify the columns that display:
Technique | Procedure |
---|---|
Add columns | Click the column name in the Available columns list, then click on the button. Result: The column displays in the Show Columns list. |
Removing columns | Click on the column name in the Show Columns list, then click Delete. |
Re-ordering columns | Click the column that you want to move up or down, then click either the or button to move it. |
Changing rows per page in the results | Enter the desired number of Rows per Page box. |
Saving searches
You can save the searches you've created for your own use, or share it with other groups.
After you've constructed your search,
- If you want to share the search with others, from the My Saved Searches dropdown list, choose the group with which you want to share.
- In the Description box, enter a meaningful name.
- Click Save.
Result: Your search is saved and available as a link on the Home page under Saved Searches>My Searches and also under the Load Saved Searches section of Query Builder.
Using Saved Searches
You can use searches you've created and saved as well as searches others have created and made available to your group.
On the RT Home page, click on the search you want to run under the Saved Searches>My Searches section.
Deleting Saved Searches
- Load the search by choosing it from the Load Saved Searches, dropdown list, then clicking Load.
Result: The search name displays in the Description box and the Delete button displays. - Click Delete.
Result: The search is removed from the list.