Version 1 (modified by trac, 17 years ago) (diff)


Trac Ticket Queries

In addition to reports, Trac provides support for custom ticket queries, used to display lists of tickets meeting a specified set of criteria.

To configure and execute a custom query, switch to the View Tickets module from the navigation bar, and select the Custom Query link.

New Interface For 0.9

The query interface has been totally revamped for Trac 0.9 to be simpler and easier to use. Users of Trac 0.8 should skip down to the sections below covering the previous interface.


When you first go to the query page the default filters will display all open tickets, or if you're logged in it will display open tickets assigned to you. Current filters can be removed by clicking the button to the right with the minus sign on the label. New filters are added from the pulldown list in the bottom-right corner of the filters box. Filters with either a text box or a pulldown menu of options can be added multiple times to perform an or of the criteria.

You can use the fields just below the filters box to group the results based on a field, or display the full description for each ticket.

Once you've edited your filters click the Update button to refresh your results.

Clicking on one of the query results will take you to that ticket. You can navigate through the results by clicking the Next Ticket or Previous Ticket links just below the main menu bar, or click the Back to Query link to return to the query page.

You can safely edit any of the tickets and continue to navigate through the results using the Next/Previous/Back? to Query links after saving your results. When you return to the query any tickets you edited will be displayed with italicized text. If one of the tickets was edited such that it no longer matches the query criteria the text will also be greyed. The query results can be refreshed and cleared of these status indicators by clicking the Update button again.

Saving Queries

You may want to save some queries so that you can come back to them later. You can do this by making a link to the query from any Wiki page. First, select the criteria from the URL line in your web browser, starting at the "?" to the end of the line. This can be pasted into a Wiki link in the following format:

[query:?status=assigned&group=owner&order=priority Assigned Tickets by Owner]

Which is displayed as:

Assigned Tickets by Owner

Previous Interface for 0.8

Query Form

A form will be presented, letting you select or enter values for any of the ticket properties (both built-in and custom). Any value selected/entered in this form will be used to constrain the set of tickets displayed. Only tickets where properties match the criteria will be displayed.

Results Display

After executing the search, a list of tickets meeting the selected criteria will show. By default, the list is sorted by priority. You can change the sorting to any other visible column by clicking on the corresponding column header. Clicking the same header again will reverse the sort order.

You can edit the query by clicking Refine Query.

See also: TracTickets, TracReports, TracGuide