|   | 1 | = !TicketQuery Wiki Macro | 
          
          
            |   | 2 |  | 
          
          
            |   | 3 | The !TicketQuery macro lets you display ticket information anywhere that accepts WikiFormatting. | 
          
          
            |   | 4 | The query language used by the `[[TicketQuery]]` macro is described in the [TracQuery#QueryLanguage TracQuery] page. | 
          
          
            |   | 5 |  | 
          
          
            |   | 6 | == Usage | 
          
          
            |   | 7 |  | 
          
          
            |   | 8 | [[MacroList(TicketQuery)]] | 
          
          
            |   | 9 |  | 
          
          
            |   | 10 | == Examples | 
          
          
            |   | 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 | ||=Number of untriaged tickets (milestone unset): =||\ | 
          
          
            |   | 51 | || **[[TicketQuery(status!=closed,milestone=,count)]]**||\ | 
          
          
            |   | 52 | || `[[TicketQuery(status!=closed,milestone=,count)]]` || | 
          
          
            |   | 53 | |----------------------------------------------------------- | 
          
          
            |   | 54 | ||=Total number of tickets: =||\ | 
          
          
            |   | 55 | || **[[TicketQuery(count)]]**||\ | 
          
          
            |   | 56 | || `[[TicketQuery(count)]]` || | 
          
          
            |   | 57 | |----------------------------------------------------------- | 
          
          
            |   | 58 | ||=Number of tickets reported **or** owned by current user: =||\ | 
          
          
            |   | 59 | || **[[TicketQuery(reporter=$USER,or,owner=$USER,count)]]**||\ | 
          
          
            |   | 60 | || `[[TicketQuery(reporter=$USER,or,owner=$USER,count)]]` || | 
          
          
            |   | 61 | |----------------------------------------------------------- | 
          
          
            |   | 62 | ||=Number of tickets created this month: =||\ | 
          
          
            |   | 63 | || **[[TicketQuery(created=thismonth..,count)]]**||\ | 
          
          
            |   | 64 | || `[[TicketQuery(created=thismonth..,count)]]` || | 
          
          
            |   | 65 | |----------------------------------------------------------- | 
          
          
            |   | 66 | ||=Number of closed Firefox tickets: =||\ | 
          
          
            |   | 67 | || **[[TicketQuery(status=closed,keywords~=firefox,count)]]**||\ | 
          
          
            |   | 68 | || `[[TicketQuery(status=closed,keywords~=firefox,count)]]` || | 
          
          
            |   | 69 | |----------------------------------------------------------- | 
          
          
            |   | 70 | ||=Number of closed Opera tickets: =||\ | 
          
          
            |   | 71 | || **[[TicketQuery(status=closed,keywords~=opera,count)]]**||\ | 
          
          
            |   | 72 | || `[[TicketQuery(status=closed,keywords~=opera,count)]]` || | 
          
          
            |   | 73 | |----------------------------------------------------------- | 
          
          
            |   | 74 | ||=Number of closed tickets affecting Firefox and Opera: =||\ | 
          
          
            |   | 75 | || **[[TicketQuery(status=closed,keywords~=firefox opera,count)]]**||\ | 
          
          
            |   | 76 | || `[[TicketQuery(status=closed,keywords~=firefox opera,count)]]` || | 
          
          
            |   | 77 | |----------------------------------------------------------- | 
          
          
            |   | 78 | ||=Number of closed tickets affecting Firefox or Opera: =||\ | 
          
          
            |   | 79 | || **[[TicketQuery(status=closed,keywords~=firefox|opera,count)]]**||\ | 
          
          
            |   | 80 | || `[[TicketQuery(status=closed,keywords~=firefox|opera,count)]]` || | 
          
          
            |   | 81 | |----------------------------------------------------------- | 
          
          
            |   | 82 | ||=Number of tickets that affect Firefox or are closed and affect Opera: =||\ | 
          
          
            |   | 83 | || **[[TicketQuery(keywords~=firefox,or,status=closed,keywords~=opera,count)]]**||\ | 
          
          
            |   | 84 | || `[[TicketQuery(status=closed,keywords~=opera,or,keywords~=firefox,count)]]` || | 
          
          
            |   | 85 | |----------------------------------------------------------- | 
          
          
            |   | 86 | ||=Number of closed Firefox tickets that don't affect Opera: =||\ | 
          
          
            |   | 87 | || **[[TicketQuery(status=closed,keywords~=firefox - opera,count)]]**||\ | 
          
          
            |   | 88 | || `[[TicketQuery(status=closed,keywords~=firefox -opera,count)]]` || | 
          
          
            |   | 89 | |----------------------------------------------------------- | 
          
          
            |   | 90 | ||=Last 3 modified tickets: =||\ | 
          
          
            |   | 91 | ||**[[TicketQuery(max=3,order=modified,desc=1,compact)]]**||\ | 
          
          
            |   | 92 | || `[[TicketQuery(max=3,order=modified,desc=1,compact)]]` || | 
          
          
            |   | 93 | |----------------------------------------------------------- | 
          
          
            |   | 94 | {{{#!th rowspan=2, style="text-align: left;" | 
          
          
            |   | 95 | Details of ticket #1: | 
          
          
            |   | 96 | }}} | 
          
          
            |   | 97 | {{{#!td style="border-bottom: 0;" | 
          
          
            |   | 98 | }}} | 
          
          
            |   | 99 | {{{#!td | 
          
          
            |   | 100 | `[[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]]` | 
          
          
            |   | 101 | }}} | 
          
          
            |   | 102 | |- | 
          
          
            |   | 103 | {{{#!td colspan=2, style="border-top: 0;" | 
          
          
            |   | 104 | [[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]] | 
          
          
            |   | 105 | }}} | 
          
          
            |   | 106 | |----------------------------------------------------------- | 
          
          
            |   | 107 |  | 
          
          
            |   | 108 | === Format: list | 
          
          
            |   | 109 |  | 
          
          
            |   | 110 | {{{ | 
          
          
            |   | 111 | [[TicketQuery(version=0.6|0.7&resolution=duplicate)]] | 
          
          
            |   | 112 | }}} | 
          
          
            |   | 113 |  | 
          
          
            |   | 114 | This is displayed as: | 
          
          
            |   | 115 |   [[TicketQuery(version=0.6|0.7&resolution=duplicate)]] | 
          
          
            |   | 116 |  | 
          
          
            |   | 117 | {{{ | 
          
          
            |   | 118 | [[TicketQuery(id=123)]] | 
          
          
            |   | 119 | }}} | 
          
          
            |   | 120 |  | 
          
          
            |   | 121 | This is displayed as: | 
          
          
            |   | 122 |   [[TicketQuery(id=123)]] | 
          
          
            |   | 123 |  | 
          
          
            |   | 124 | === Format: compact | 
          
          
            |   | 125 |  | 
          
          
            |   | 126 | {{{ | 
          
          
            |   | 127 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]] | 
          
          
            |   | 128 | }}} | 
          
          
            |   | 129 |  | 
          
          
            |   | 130 | This is displayed as: | 
          
          
            |   | 131 |   [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]] | 
          
          
            |   | 132 |  | 
          
          
            |   | 133 | === Format: count | 
          
          
            |   | 134 |  | 
          
          
            |   | 135 | {{{ | 
          
          
            |   | 136 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]] | 
          
          
            |   | 137 | }}} | 
          
          
            |   | 138 |  | 
          
          
            |   | 139 | This is displayed as: | 
          
          
            |   | 140 |   [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]] | 
          
          
            |   | 141 |  | 
          
          
            |   | 142 | === Format: progress | 
          
          
            |   | 143 |  | 
          
          
            |   | 144 | {{{ | 
          
          
            |   | 145 | [[TicketQuery(milestone=0.12.8&group=type,format=progress)]] | 
          
          
            |   | 146 | }}} | 
          
          
            |   | 147 |  | 
          
          
            |   | 148 | This is displayed as: | 
          
          
            |   | 149 |   [[TicketQuery(milestone=0.12.8&group=type,format=progress)]] | 
          
          
            |   | 150 |  | 
          
          
            |   | 151 | === Format: table | 
          
          
            |   | 152 |  | 
          
          
            |   | 153 | You can choose the columns displayed in the table format (`format=table`) using `col=<field>`. You can specify multiple fields and the order they are displayed in by placing pipes (`|`) between the columns: | 
          
          
            |   | 154 | {{{ | 
          
          
            |   | 155 | [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]] | 
          
          
            |   | 156 | }}} | 
          
          
            |   | 157 |  | 
          
          
            |   | 158 | This is displayed as: | 
          
          
            |   | 159 | [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]] | 
          
          
            |   | 160 |  | 
          
          
            |   | 161 | ==== Full rows | 
          
          
            |   | 162 |  | 
          
          
            |   | 163 | In ''table'' format you can specify full rows using `rows=<field>`: | 
          
          
            |   | 164 | {{{ | 
          
          
            |   | 165 | [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]] | 
          
          
            |   | 166 | }}} | 
          
          
            |   | 167 |  | 
          
          
            |   | 168 | This is displayed as: | 
          
          
            |   | 169 | [[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]] | 
          
          
            |   | 170 |  | 
          
          
            |   | 171 | ---- | 
          
          
            |   | 172 | See also: TracQuery, TracTickets, TracReports |