Trac Ticket Queries
Table of Contents
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.
Filters
When you first go to the query page the default filter will display tickets relevant to you:
 If logged in then all open tickets it will display open tickets assigned to you.
 If not logged in but you have specified a name or email address in the preferences then it will display all open tickets where your email (or name if email not defined) is in the CC list.
 If not logged and no name/email defined in the preferences then all open issues are displayed.
Current filters can be removed by clicking the button to the left with the minus sign on the label. New filters are added from the pulldown lists at the bottom corners of the filters box ('And' conditions on the left, 'Or' conditions on the right). 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.
Navigating Tickets
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 which were 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. Lastly, if a new ticket matching the query criteria has been created, it will be shown in bold.
The query results can be refreshed and cleared of these status indicators by clicking the Update button again.
Saving Queries
Trac allows you to save the query as a named query accessible from the reports module. To save a query ensure that you have Updated the view and then click the Save query button displayed beneath the results. You can also save references to queries in Wiki content, as described below.
Note: one way to easily build queries like the ones below, you can build and test the queries in the Custom report module and when ready  click Save query. This will build the query string for you. All you need to do is remove the extra line breaks.
Note: you must have the REPORT_CREATE permission in order to save queries to the list of default reports. The Save query button will only appear if you are logged in as a user that has been granted this permission. If your account does not have permission to create reports, you can still use the methods below to save a query.
Using TracLinks
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.
[query:status=newassignedreopened&version=1.0 Active tickets against 1.0]
Which is displayed as:
This uses a very simple query language to specify the criteria (see Query Language).
Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading ? character:
[query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]
Which is displayed as:
Using the [[TicketQuery]] Macro
The TicketQuery macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.
Example:
[[TicketQuery(version=0.60.7&resolution=duplicate)]]
This is displayed as:
No results
Just like the query: wiki links, the parameter of this macro expects a query string formatted according to the rules of the simple ticket query language. This also allows displaying the link and description of a single ticket:
[[TicketQuery(id=123)]]
This is displayed as:
No results
A more compact representation without the ticket summaries is also available:
[[TicketQuery(version=0.60.7&resolution=duplicate, compact)]]
This is displayed as:
No results
Finally, if you wish to receive only the number of defects that match the query, use the count parameter.
[[TicketQuery(version=0.60.7&resolution=duplicate, count)]]
This is displayed as:
0
Customizing the table format
You can also customize the columns displayed in the table format (format=table) by using col=<field>  you can specify multiple fields and what order they are displayed by placing pipes () between the columns like below:
[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolutionsummaryownerreporter)]]
This is displayed as:
Results (1  3 of 6)
Ticket  Resolution  Summary  Owner  Reporter 

#6  worksforme  Cppad's examples do not compile on AIX  somebody  andreasw 
#5  worksforme  failure compiling complex_poly  somebody  stefan 
#4  fixed  gcc 4.3 complain about ambiguous conversion  somebody  stefan 
Full rows
In table format you can also have full rows by using rows=<field> like below:
[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolutionsummaryownerreporter,rows=description)]]
This is displayed as:
Results (1  3 of 6)
Ticket  Resolution  Summary  Owner  Reporter 

#6  worksforme  Cppad's examples do not compile on AIX  somebody  andreasw 
Description 


#5  worksforme  failure compiling complex_poly  somebody  stefan 
Description 
Hi, with trunk rev. 1063 I get the following errors when I try to compile example/complex_poly.cpp: g++ I. g MT complex_poly.o MD MP MF .deps/complex_poly.Tpo c o complex_poly.o example/complex_poly.cpp cppad/local/mul.hpp: In member function ‘CppAD::AD<Base> CppAD::AD<Base>::operator*(const CppAD::AD<Base>&) const [with Base = std::complex<double>]’: cppad/poly.hpp:180: instantiated from ‘Type CppAD::Poly(size_t, const Vector&, const Type&) [with Type = CppAD::AD<std::complex<double> >, Vector = CppAD::vector<CppAD::AD<std::complex<double> > >]’ example/complex_poly.cpp:67: instantiated from here cppad/local/mul.hpp:41: error: no matching function for call to ‘IdenticalZero(const std::complex<double>&)’ cppad/local/identical.hpp:144: note: candidates are: bool CppAD::IdenticalZero(const float&) cppad/local/identical.hpp:146: note: bool CppAD::IdenticalZero(const double&) cppad/local/mul.hpp:44: error: no matching function for call to ‘IdenticalOne(const std::complex<double>&)’ cppad/local/identical.hpp:153: note: candidates are: bool CppAD::IdenticalOne(const float&) cppad/local/identical.hpp:155: note: bool CppAD::IdenticalOne(const double&) cppad/poly.hpp:180: instantiated from ‘Type CppAD::Poly(size_t, const Vector&, const Type&) [with Type = CppAD::AD<std::complex<double> >, Vector = CppAD::vector<CppAD::AD<std::complex<double> > >]’ example/complex_poly.cpp:67: instantiated from here cppad/local/mul.hpp:59: error: no matching function for call to ‘IdenticalZero(const std::complex<double>&)’ cppad/local/identical.hpp:144: note: candidates are: bool CppAD::IdenticalZero(const float&) cppad/local/identical.hpp:146: note: bool CppAD::IdenticalZero(const double&) cppad/local/mul.hpp:62: error: no matching function for call to ‘IdenticalOne(const std::complex<double>&)’ cppad/local/identical.hpp:153: note: candidates are: bool CppAD::IdenticalOne(const float&) cppad/local/identical.hpp:155: note: bool CppAD::IdenticalOne(const double&) cppad/local/mul_eq.hpp: In member function ‘CppAD::AD<Base>& CppAD::AD<Base>::operator*=(const CppAD::AD<Base>&) [with Base = std::complex<double>]’: cppad/poly.hpp:190: instantiated from ‘Type CppAD::Poly(size_t, const Vector&, const Type&) [with Type = CppAD::AD<std::complex<double> >, Vector = CppAD::vector<CppAD::AD<std::complex<double> > >]’ example/complex_poly.cpp:67: instantiated from here cppad/local/mul_eq.hpp:27: error: no matching function for call to ‘IdenticalZero(std::complex<double>&)’ cppad/local/identical.hpp:144: note: candidates are: bool CppAD::IdenticalZero(const float&) cppad/local/identical.hpp:146: note: bool CppAD::IdenticalZero(const double&) cppad/local/mul_eq.hpp:28: error: no matching function for call to ‘IdenticalOne(std::complex<double>&)’ cppad/local/identical.hpp:153: note: candidates are: bool CppAD::IdenticalOne(const float&) cppad/local/identical.hpp:155: note: bool CppAD::IdenticalOne(const double&) cppad/local/mul_eq.hpp:42: error: no matching function for call to ‘IdenticalOne(const std::complex<double>&)’ cppad/local/identical.hpp:153: note: candidates are: bool CppAD::IdenticalOne(const float&) cppad/local/identical.hpp:155: note: bool CppAD::IdenticalOne(const double&) cppad/local/mul_eq.hpp:43: error: no matching function for call to ‘IdenticalZero(const std::complex<double>&)’ cppad/local/identical.hpp:144: note: candidates are: bool CppAD::IdenticalZero(const float&) cppad/local/identical.hpp:146: note: bool CppAD::IdenticalZero(const double&) cppad/local/add_eq.hpp: In member function ‘CppAD::AD<Base>& CppAD::AD<Base>::operator+=(const CppAD::AD<Base>&) [with Base = std::complex<double>]’: cppad/poly.hpp:191: instantiated from ‘Type CppAD::Poly(size_t, const Vector&, const Type&) [with Type = CppAD::AD<std::complex<double> >, Vector = CppAD::vector<CppAD::AD<std::complex<double> > >]’ example/complex_poly.cpp:67: instantiated from here cppad/local/add_eq.hpp:27: error: no matching function for call to ‘IdenticalZero(std::complex<double>&)’ cppad/local/identical.hpp:144: note: candidates are: bool CppAD::IdenticalZero(const float&) cppad/local/identical.hpp:146: note: bool CppAD::IdenticalZero(const double&) cppad/local/add_eq.hpp:37: error: no matching function for call to ‘IdenticalZero(const std::complex<double>&)’ cppad/local/identical.hpp:144: note: candidates are: bool CppAD::IdenticalZero(const float&) cppad/local/identical.hpp:146: note: bool CppAD::IdenticalZero(const double&) cppad/local/forward_sweep.hpp: In function ‘size_t CppAD::ForwardSweep(bool, size_t, size_t, CppAD::TapeRec<Base>*, size_t, Base*) [with Base = std::complex<double>]’: cppad/local/fun_construct.hpp:217: instantiated from ‘CppAD::ADFun<Base>::ADFun(const VectorAD&, const VectorAD&) [with ADvector = CppAD::vector<CppAD::AD<std::complex<double> > >, Base = std::complex<double>]’ example/complex_poly.cpp:70: instantiated from here cppad/local/forward_sweep.hpp:388: error: no matching function for call to ‘LessThanZero(std::complex<double>)’ cppad/local/ordered.hpp:156: note: candidates are: bool CppAD::LessThanZero(const float&) cppad/local/ordered.hpp:159: note: bool CppAD::LessThanZero(const double&) cppad/local/forward_sweep.hpp:393: error: no matching function for call to ‘LessThanOrZero(std::complex<double>)’ cppad/local/ordered.hpp:168: note: candidates are: bool CppAD::LessThanOrZero(const float&) cppad/local/ordered.hpp:171: note: bool CppAD::LessThanOrZero(const double&) cppad/local/forward_sweep.hpp:403: error: no matching function for call to ‘GreaterThanOrZero(std::complex<double>)’ cppad/local/ordered.hpp:143: note: candidates are: bool CppAD::GreaterThanOrZero(const float&) cppad/local/ordered.hpp:146: note: bool CppAD::GreaterThanOrZero(const double&) cppad/local/forward_sweep.hpp:408: error: no matching function for call to ‘GreaterThanZero(std::complex<double>)’ cppad/local/ordered.hpp:131: note: candidates are: bool CppAD::GreaterThanZero(const float&) cppad/local/ordered.hpp:134: note: bool CppAD::GreaterThanZero(const double&) cppad/local/fun_construct.hpp:217: instantiated from ‘CppAD::ADFun<Base>::ADFun(const VectorAD&, const VectorAD&) [with ADvector = CppAD::vector<CppAD::AD<std::complex<double> > >, Base = std::complex<double>]’ example/complex_poly.cpp:70: instantiated from here cppad/local/forward_sweep.hpp:573: error: no matching function for call to ‘Integer(const std::complex<double>&)’ cppad/local/integer.hpp:105: note: candidates are: int CppAD::Integer(const float&) cppad/local/integer.hpp:108: note: int CppAD::Integer(const double&) cppad/local/fun_construct.hpp:217: instantiated from ‘CppAD::ADFun<Base>::ADFun(const VectorAD&, const VectorAD&) [with ADvector = CppAD::vector<CppAD::AD<std::complex<double> > >, Base = std::complex<double>]’ example/complex_poly.cpp:70: instantiated from here cppad/local/forward_sweep.hpp:865: error: no matching function for call to ‘Integer(const std::complex<double>&)’ cppad/local/integer.hpp:105: note: candidates are: int CppAD::Integer(const float&) cppad/local/integer.hpp:108: note: int CppAD::Integer(const double&) cppad/local/forward_sweep.hpp:894: error: no matching function for call to ‘Integer(const std::complex<double>&)’ cppad/local/integer.hpp:105: note: candidates are: int CppAD::Integer(const float&) cppad/local/integer.hpp:108: note: int CppAD::Integer(const double&) cppad/local/abs_op.hpp: In function ‘void CppAD::ForAbsOp(size_t, Base*, const Base*) [with Base = std::complex<double>]’: cppad/local/forward_sweep.hpp:253: instantiated from ‘size_t CppAD::ForwardSweep(bool, size_t, size_t, CppAD::TapeRec<Base>*, size_t, Base*) [with Base = std::complex<double>]’ cppad/local/fun_construct.hpp:217: instantiated from ‘CppAD::ADFun<Base>::ADFun(const VectorAD&, const VectorAD&) [with ADvector = CppAD::vector<CppAD::AD<std::complex<double> > >, Base = std::complex<double>]’ example/complex_poly.cpp:70: instantiated from here cppad/local/abs_op.hpp:149: error: no matching function for call to ‘GreaterThanZero(const std::complex<double>&)’ cppad/local/ordered.hpp:131: note: candidates are: bool CppAD::GreaterThanZero(const float&) cppad/local/ordered.hpp:134: note: bool CppAD::GreaterThanZero(const double&) cppad/local/abs_op.hpp:151: error: no matching function for call to ‘LessThanZero(const std::complex<double>&)’ cppad/local/ordered.hpp:156: note: candidates are: bool CppAD::LessThanZero(const float&) cppad/local/ordered.hpp:159: note: bool CppAD::LessThanZero(const double&) cppad/local/acos_op.hpp: In function ‘void CppAD::ForAcosOp(size_t, Base*, Base*, const Base*) [with Base = std::complex<double>]’: cppad/local/forward_sweep.hpp:302: instantiated from ‘size_t CppAD::ForwardSweep(bool, size_t, size_t, CppAD::TapeRec<Base>*, size_t, Base*) [with Base = std::complex<double>]’ cppad/local/fun_construct.hpp:217: instantiated from ‘CppAD::ADFun<Base>::ADFun(const VectorAD&, const VectorAD&) [with ADvector = CppAD::vector<CppAD::AD<std::complex<double> > >, Base = std::complex<double>]’ example/complex_poly.cpp:70: instantiated from here cppad/local/acos_op.hpp:180: error: no matching function for call to ‘acos(const std::complex<double>&)’ cppad/local/std_math_unary.hpp:309: note: candidates are: float CppAD::acos(const float&) cppad/local/std_math_unary.hpp:309: note: double CppAD::acos(const double&) /usr/include/c++/4.2.1/cmath:107: note: long double std::acos(long double) /usr/include/c++/4.2.1/cmath:103: note: float std::acos(float) /usr/include/bits/mathcalls.h:55: note: double acos(double) cppad/local/asin_op.hpp: In function ‘void CppAD::ForAsinOp(size_t, Base*, Base*, const Base*) [with Base = std::complex<double>]’: cppad/local/forward_sweep.hpp:317: instantiated from ‘size_t CppAD::ForwardSweep(bool, size_t, size_t, CppAD::TapeRec<Base>*, size_t, Base*) [with Base = std::complex<double>]’ cppad/local/fun_construct.hpp:217: instantiated from ‘CppAD::ADFun<Base>::ADFun(const VectorAD&, const VectorAD&) [with ADvector = CppAD::vector<CppAD::AD<std::complex<double> > >, Base = std::complex<double>]’ example/complex_poly.cpp:70: instantiated from here cppad/local/asin_op.hpp:179: error: no matching function for call to ‘asin(const std::complex<double>&)’ cppad/local/std_math_unary.hpp:313: note: candidates are: float CppAD::asin(const float&) cppad/local/std_math_unary.hpp:313: note: double CppAD::asin(const double&) /usr/include/c++/4.2.1/cmath:123: note: long double std::asin(long double) /usr/include/c++/4.2.1/cmath:119: note: float std::asin(float) /usr/include/bits/mathcalls.h:57: note: double asin(double) cppad/local/atan_op.hpp: In function ‘void CppAD::ForAtanOp(size_t, Base*, Base*, const Base*) [with Base = std::complex<double>]’: cppad/local/forward_sweep.hpp:332: instantiated from ‘size_t CppAD::ForwardSweep(bool, size_t, size_t, CppAD::TapeRec<Base>*, size_t, Base*) [with Base = std::complex<double>]’ cppad/local/fun_construct.hpp:217: instantiated from ‘CppAD::ADFun<Base>::ADFun(const VectorAD&, const VectorAD&) [with ADvector = CppAD::vector<CppAD::AD<std::complex<double> > >, Base = std::complex<double>]’ example/complex_poly.cpp:70: instantiated from here cppad/local/atan_op.hpp:178: error: no matching function for call to ‘atan(const std::complex<double>&)’ cppad/local/std_math_unary.hpp:317: note: candidates are: float CppAD::atan(const float&) cppad/local/std_math_unary.hpp:317: note: double CppAD::atan(const double&) /usr/include/c++/4.2.1/cmath:139: note: long double std::atan(long double) /usr/include/c++/4.2.1/cmath:135: note: float std::atan(float) /usr/include/bits/mathcalls.h:59: note: double atan(double) cppad/local/tape_rec.hpp: In member function ‘size_t CppAD::TapeRec<Base>::PutPar(const Base&) [with Base = std::complex<double>]’: cppad/local/ad_tape.hpp:755: instantiated from ‘void CppAD::ADTape<Base>::RecordOp(CppAD::OpCode, CppAD::AD<Base>&, size_t, const Base&) [with Base = std::complex<double>]’ cppad/local/mul.hpp:50: instantiated from ‘CppAD::AD<Base> CppAD::AD<Base>::operator*(const CppAD::AD<Base>&) const [with Base = std::complex<double>]’ cppad/poly.hpp:180: instantiated from ‘Type CppAD::Poly(size_t, const Vector&, const Type&) [with Type = CppAD::AD<std::complex<double> >, Vector = CppAD::vector<CppAD::AD<std::complex<double> > >]’ example/complex_poly.cpp:67: instantiated from here cppad/local/tape_rec.hpp:532: error: no matching function for call to ‘IdenticalEqualPar(std::complex<double>&, const std::complex<double>&)’ cppad/local/identical.hpp:162: note: candidates are: bool CppAD::IdenticalEqualPar(const float&, const float&) cppad/local/identical.hpp:164: note: bool CppAD::IdenticalEqualPar(const double&, const double&) make[1]: *** [complex_poly.o] Fehler 1 The configure line was configure C withExample withTestMore I'm using gcc 4.2.1 on a Linux 64 Bit Intel machine. Stefan 

#4  fixed  gcc 4.3 complain about ambiguous conversion  somebody  stefan 
Description 
Hi, with gcc 4.3 I get the following error when compiling stable 2.0 or trunk: example/bender_quad.cpp: In member function 'CppAD::vector<Type><unnamed>::Fun<Type>::h(const CppAD::vector<Type>&, const CppAD::vector<double>&) [with Type = CppAD::AD<double>]': cppad/local/bender_quad.hpp:348: instantiated from 'void CppAD::BenderQuad(const BAvector&, const BAvector&, Fun, BAvector&, BAvector&, BAvector&) [with BAvector = CppAD::vector<double>, Fun = <unnamed>::Fun<CppAD::AD<double> >]' example/bender_quad.cpp:188: instantiated from here example/bender_quad.cpp:109: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: cppad/local/sub.hpp:60: note: candidate 1: CppAD::AD<double> CppAD::operator(const CppAD::AD<double>&, const double&) cppad/local/ad.hpp:120: note: candidate 2: CppAD::AD<Base> CppAD::AD<Base>::operator(const CppAD::AD<Base>&) const [with Base = double] example/bender_quad.cpp: In member function 'CppAD::vector<Type><unnamed>::Fun<Type>::f(const CppAD::vector<Type>&, const CppAD::vector<Type>&) [with Type = CppAD::AD<double>]': cppad/local/bender_quad.hpp:361: instantiated from 'void CppAD::BenderQuad(const BAvector&, const BAvector&, Fun, BAvector&, BAvector&, BAvector&) [with BAvector = CppAD::vector<double>, Fun = <unnamed>::Fun<CppAD::AD<double> >]' example/bender_quad.cpp:188: instantiated from here example/bender_quad.cpp:94: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: cppad/local/sub.hpp:60: note: candidate 1: CppAD::AD<double> CppAD::operator(const CppAD::AD<double>&, const double&) cppad/local/ad.hpp:120: note: candidate 2: CppAD::AD<Base> CppAD::AD<Base>::operator(const CppAD::AD<Base>&) const [with Base = double] Stefan 
Query Language
query: TracLinks and the [[TicketQuery]] macro both use a mini “query language” for specifying query filters. Basically, the filters are separated by ampersands (&). Each filter then consists of the ticket field name, an operator, and one or more values. More than one value are separated by a pipe (), meaning that the filter matches any of the values. To include a literal & or  in a value, escape the character with a backslash (\).
The available operators are:
=  the field content exactly matches one of the values 
~=  the field content contains one or more of the values 
^=  the field content starts with one of the values 
$=  the field content ends with one of the values 
All of these operators can also be negated:
!=  the field content matches none of the values 
!~=  the field content does not contain any of the values 
!^=  the field content does not start with any of the values 
!$=  the field content does not end with any of the values 
The date fields created and modified can be constrained by using the = operator and specifying a value containing two dates separated by two dots (..). Either end of the date range can be left empty, meaning that the corresponding end of the range is open. The date parser understands a few natural date specifications like "3 weeks ago", "last month" and "now", as well as Bugzillastyle date specifications like "1d", "2w", "3m" or "4y" for 1 day, 2 weeks, 3 months and 4 years, respectively. Spaces in date specifications can be left out to avoid having to quote the query string.
created=20070101..20080101  query tickets created in 2007 
created=lastmonth..thismonth  query tickets created during the previous month 
modified=1weekago..  query tickets that have been modified in the last week 
modified=..30daysago  query tickets that have been inactive for the last 30 days 
See also: TracTickets, TracReports, TracGuide