| 1 | = !TicketQuery Wiki Macro |
| 2 | |
| 3 | The !TicketQuery macro lets you display information on tickets within wiki pages. |
| 4 | The query language used by the `[[TicketQuery]]` macro is described in [TracQuery#UsingtheTicketQueryMacro TracQuery] page. |
| 5 | |
| 6 | == Usage |
| 7 | |
| 8 | [[MacroList(TicketQuery)]] |
| 9 | |
| 10 | == Example |
| 11 | |
| 12 | ||= **Example** =||= **Result** =||= **Macro** =|| |
| 13 | |----------------------------------------------------------- |
| 14 | ||=Number of [query:status=new&milestone= Triage tickets]: =||\ |
| 15 | || **[[TicketQuery(status=new&milestone=,count)]]**||\ |
| 16 | || `[[TicketQuery(status=new&milestone=,count)]]` || |
| 17 | |----------------------------------------------------------- |
| 18 | ||=Number of new tickets: =||\ |
| 19 | || **[[TicketQuery(status=new,count)]]**||\ |
| 20 | || `[[TicketQuery(status=new,count)]]` || |
| 21 | |----------------------------------------------------------- |
| 22 | ||=Number of reopened tickets: =||\ |
| 23 | || **[[TicketQuery(status=reopened,count)]]**||\ |
| 24 | || `[[TicketQuery(status=reopened,count)]]` || |
| 25 | |----------------------------------------------------------- |
| 26 | ||=Number of assigned tickets: =||\ |
| 27 | || **[[TicketQuery(status=assigned,count)]]**||\ |
| 28 | || `[[TicketQuery(status=assigned,count)]]` || |
| 29 | |----------------------------------------------------------- |
| 30 | ||=Number of invalid tickets: =||\ |
| 31 | || **[[TicketQuery(status=closed,resolution=invalid,count)]]**||\ |
| 32 | || `[[TicketQuery(status=closed,resolution=invalid,count)]]` || |
| 33 | |----------------------------------------------------------- |
| 34 | ||=Number of worksforme tickets: =||\ |
| 35 | || **[[TicketQuery(status=closed,resolution=worksforme,count)]]**||\ |
| 36 | || `[[TicketQuery(status=closed,resolution=worksforme,count)]]` || |
| 37 | |----------------------------------------------------------- |
| 38 | ||=Number of duplicate tickets: =||\ |
| 39 | || **[[TicketQuery(status=closed,resolution=duplicate,count)]]**||\ |
| 40 | || `[[TicketQuery(status=closed,resolution=duplicate,count)]]` || |
| 41 | |----------------------------------------------------------- |
| 42 | ||=Number of wontfix tickets: =||\ |
| 43 | || **[[TicketQuery(status=closed,resolution=wontfix,count)]]**||\ |
| 44 | || `[[TicketQuery(status=closed,resolution=wontfix,count)]]` || |
| 45 | |----------------------------------------------------------- |
| 46 | ||=Number of fixed tickets: =||\ |
| 47 | || **[[TicketQuery(status=closed,resolution=fixed,count)]]**||\ |
| 48 | || `[[TicketQuery(status=closed,resolution=fixed,count)]]` || |
| 49 | |----------------------------------------------------------- |
| 50 | ||=Total number of tickets: =||\ |
| 51 | || **[[TicketQuery(count)]]**||\ |
| 52 | || `[[TicketQuery(count)]]` || |
| 53 | |----------------------------------------------------------- |
| 54 | ||=Number of tickets reported **or** owned by current user: =||\ |
| 55 | || **[[TicketQuery(reporter=$USER,or,owner=$USER,count)]]**||\ |
| 56 | || `[[TicketQuery(reporter=$USER,or,owner=$USER,count)]]` || |
| 57 | |----------------------------------------------------------- |
| 58 | ||=Number of tickets created this month: =||\ |
| 59 | || **[[TicketQuery(created=thismonth..,count)]]**||\ |
| 60 | || `[[TicketQuery(created=thismonth..,count)]]` || |
| 61 | |----------------------------------------------------------- |
| 62 | ||=Last 3 modified tickets: =||\ |
| 63 | ||**[[TicketQuery(max=3,order=modified,desc=1,compact)]]**||\ |
| 64 | || `[[TicketQuery(max=3,order=modified,desc=1,compact)]]` || |
| 65 | |----------------------------------------------------------- |
| 66 | {{{#!th rowspan=2, style="text-align: left;" |
| 67 | Details of ticket #1: |
| 68 | }}} |
| 69 | {{{#!td style="border-bottom: 0;" |
| 70 | }}} |
| 71 | {{{#!td |
| 72 | `[[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]]` |
| 73 | }}} |
| 74 | |- |
| 75 | {{{#!td colspan=2, style="border-top: 0;" |
| 76 | [[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]] |
| 77 | }}} |
| 78 | |----------------------------------------------------------- |
| 79 | |
| 80 | == Using the `[[TicketQuery]]` Macro |
| 81 | |
| 82 | The [trac:TicketQuery TicketQuery] macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting. |
| 83 | |
| 84 | Example: |
| 85 | {{{ |
| 86 | [[TicketQuery(version=0.6|0.7&resolution=duplicate)]] |
| 87 | }}} |
| 88 | |
| 89 | This is displayed as: |
| 90 | [[TicketQuery(version=0.6|0.7&resolution=duplicate)]] |
| 91 | |
| 92 | Just like the [wiki:TracQuery#UsingTracLinks query: wiki links], the parameter of this macro expects a query string formatted according to the rules of the simple [wiki:TracQuery#QueryLanguage ticket query language]. This also displays the link and description of a single ticket: |
| 93 | {{{ |
| 94 | [[TicketQuery(id=123)]] |
| 95 | }}} |
| 96 | |
| 97 | This is displayed as: |
| 98 | [[TicketQuery(id=123)]] |
| 99 | |
| 100 | A more compact representation without the ticket summaries is: |
| 101 | {{{ |
| 102 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]] |
| 103 | }}} |
| 104 | |
| 105 | This is displayed as: |
| 106 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]] |
| 107 | |
| 108 | Finally, if you wish to receive only the number of defects that match the query, use the `count` parameter: |
| 109 | {{{ |
| 110 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]] |
| 111 | }}} |
| 112 | |
| 113 | This is displayed as: |
| 114 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]] |
| 115 | |
| 116 | ---- |
| 117 | See also: TracQuery, TracTickets, TracReports, TracGuide |