1 | | |
2 | | = Trac Reports = |
3 | | [[TracGuideToc]] |
4 | | |
5 | | The Trac reports module provides a simple, yet powerful reporting facility |
6 | | to present information about tickets in the Trac database. |
7 | | |
8 | | Rather than have its own report definition format, TracReports relies on standard SQL |
9 | | `SELECT` statements for custom report definition. |
10 | | |
11 | | '''Note:''' ''The report module is being phased out in its current form because it seriously limits the ability of the Trac team to make adjustments to the underlying database schema. We believe that the [wiki:TracQuery query module] is a good replacement that provides more flexibility and better usability. While there are certain reports that cannot yet be handled by the query module, we intend to further enhance it so that at some point the reports module can be completely removed. This also means that there will be no major enhancements to the report module anymore.'' |
12 | | |
13 | | ''You can already completely replace the reports module by the query module simply by disabling the former in [wiki:TracIni trac.ini]:'' |
14 | | {{{ |
15 | | [components] |
16 | | trac.ticket.report.* = disabled |
17 | | }}} |
18 | | ''This will make the query module the default handler for the “View Tickets” navigation item. We encourage you to try this configuration and report back what kind of features of reports you are missing, if any.'' |
19 | | |
20 | | A report consists of these basic parts: |
21 | | * '''ID''' -- Unique (sequential) identifier |
22 | | * '''Title''' -- Descriptive title |
23 | | * '''Description''' -- A brief description of the report, in WikiFormatting text. |
24 | | * '''Report Body''' -- List of results from report query, formatted according to the methods described below. |
25 | | * '''Footer''' -- Links to alternative download formats for this report. |
26 | | |
27 | | == Changing Sort Order == |
28 | | Simple reports - ungrouped reports to be specific - can be changed to be sorted by any column simply by clicking the column header. |
29 | | |
30 | | If a column header is a hyperlink (red), click the column you would like to sort by. Clicking the same header again reverses the order. |
31 | | |
32 | | |
33 | | == Alternative Download Formats == |
34 | | Aside from the default HTML view, reports can also be exported in a number of alternative formats. |
35 | | At the bottom of the report page, you will find a list of available data formats. Click the desired link to |
36 | | download the alternative report format. |
37 | | |
38 | | === Comma-delimited - CSV (Comma Separated Values) === |
39 | | Export the report as plain text, each row on its own line, columns separated by a single comma (','). |
40 | | '''Note:''' Carriage returns, line feeds, and commas are stripped from column data to preserve the CSV structure. |
41 | | |
42 | | === Tab-delimited === |
43 | | Like above, but uses tabs (\t) instead of comma. |
44 | | |
45 | | === RSS - XML Content Syndication === |
46 | | All reports support syndication using XML/RSS 2.0. To subscribe to an RSS feed, click the orange 'XML' icon at the bottom of the page. See TracRss for general information on RSS support in Trac. |
47 | | |
48 | | ---- |
49 | | |
50 | | == Creating Custom Reports == |
51 | | |
52 | | ''Creating a custom report requires a comfortable knowledge of SQL.'' |
53 | | |
54 | | A report is basically a single named SQL query, executed and presented by |
55 | | Trac. Reports can be viewed and created from a custom SQL expression directly |
56 | | in from the web interface. |
57 | | |
58 | | Typically, a report consists of a SELECT-expression from the 'ticket' table, |
59 | | using the available columns and sorting the way you want it. |
60 | | |
61 | | == Ticket columns == |
62 | | The ''ticket'' table has the following columns: |
63 | | * id |
64 | | * time |
65 | | * changetime |
66 | | * component |
67 | | * severity |
68 | | * priority |
69 | | * owner |
70 | | * reporter |
71 | | * cc |
72 | | * version |
73 | | * milestone |
74 | | * status |
75 | | * resolution |
76 | | * summary |
77 | | * description |
78 | | |
79 | | See TracTickets for a detailed description of the column fields. |
80 | | |
81 | | '''all active tickets, sorted by priority and time''' |
82 | | |
83 | | '''Example:''' ''All active tickets, sorted by priority and time'' |
84 | | {{{ |
85 | | SELECT id AS ticket, status, severity, priority, owner, |
86 | | time as created, summary FROM ticket |
87 | | WHERE status IN ('new', 'assigned', 'reopened') |
88 | | ORDER BY priority, time |
89 | | }}} |
90 | | |
91 | | |
92 | | ---- |
93 | | |
94 | | |
95 | | == Advanced Reports: Dynamic Variables == |
96 | | For more flexible reports, Trac supports the use of ''dynamic variables'' in report SQL statements. |
97 | | In short, dynamic variables are ''special'' strings that are replaced by custom data before query execution. |
98 | | |
99 | | === Using Variables in a Query === |
100 | | The syntax for dynamic variables is simple, any upper case word beginning with '$' is considered a variable. |
101 | | |
102 | | Example: |
103 | | {{{ |
104 | | SELECT id AS ticket,summary FROM ticket WHERE priority='$PRIORITY' |
105 | | }}} |
106 | | |
107 | | To assign a value to $PRIORITY when viewing the report, you must define it as an argument in the report URL, leaving out the the leading '$'. |
108 | | |
109 | | Example: |
110 | | {{{ |
111 | | http://projects.edgewall.com/trac/reports/14?PRIORITY=high |
112 | | }}} |
113 | | |
114 | | To use multiple variables, separate them with an '&'. |
115 | | |
116 | | Example: |
117 | | {{{ |
118 | | http://projects.edgewall.com/trac/reports/14?PRIORITY=high&SEVERITY=critical |
119 | | }}} |
120 | | |
121 | | |
122 | | === Special/Constant Variables === |
123 | | There is one ''magic'' dynamic variable to allow practical reports, its value automatically set without having to change the URL. |
124 | | |
125 | | * $USER -- Username of logged in user. |
126 | | |
127 | | Example (''List all tickets assigned to me''): |
128 | | {{{ |
129 | | SELECT id AS ticket,summary FROM ticket WHERE owner='$USER' |
130 | | }}} |
131 | | |
132 | | |
133 | | ---- |
134 | | |
135 | | |
136 | | == Advanced Reports: Custom Formatting == |
137 | | Trac is also capable of more advanced reports, including custom layouts, |
138 | | result grouping and user-defined CSS styles. To create such reports, we'll use |
139 | | specialized SQL statements to control the output of the Trac report engine. |
140 | | |
141 | | == Special Columns == |
142 | | To format reports, TracReports looks for 'magic' column names in the query |
143 | | result. These 'magic' names are processed and affect the layout and style of the |
144 | | final report. |
145 | | |
146 | | === Automatically formatted columns === |
147 | | * '''ticket''' -- Ticket ID number. Becomes a hyperlink to that ticket. |
148 | | * '''created, modified, date, time''' -- Format cell as a date and/or time. |
149 | | |
150 | | * '''description''' -- Ticket description field, parsed through the wiki engine. |
151 | | |
152 | | '''Example:''' |
153 | | {{{ |
154 | | SELECT id as ticket, created, status, summary FROM ticket |
155 | | }}} |
156 | | |
157 | | === Custom formatting columns === |
158 | | Columns whose names begin and end with 2 underscores (Example: '''`__color__`''') are |
159 | | assumed to be ''formatting hints'', affecting the appearance of the row. |
160 | | |
161 | | * '''`__group__`''' -- Group results based on values in this column. Each group will have its own header and table. |
162 | | * '''`__color__`''' -- Should be a numeric value ranging from 1 to 5 to select a pre-defined row color. Typically used to color rows by issue priority. |
163 | | * '''`__style__`''' -- A custom CSS style expression to use for the current row. |
164 | | |
165 | | '''Example:''' ''List active tickets, grouped by milestone, colored by priority'' |
166 | | {{{ |
167 | | SELECT p.value AS __color__, |
168 | | t.milestone AS __group__, |
169 | | (CASE owner WHEN 'daniel' THEN 'font-weight: bold; background: red;' ELSE '' END) AS __style__, |
170 | | t.id AS ticket, summary |
171 | | FROM ticket t,enum p |
172 | | WHERE t.status IN ('new', 'assigned', 'reopened') |
173 | | AND p.name=t.priority AND p.type='priority' |
174 | | ORDER BY t.milestone, p.value, t.severity, t.time |
175 | | }}} |
176 | | |
177 | | '''Note:''' A table join is used to match ''ticket'' priorities with their |
178 | | numeric representation from the ''enum'' table. |
179 | | |
180 | | === Changing layout of report rows === |
181 | | By default, all columns on each row are display on a single row in the HTML |
182 | | report, possibly formatted according to the descriptions above. However, it's |
183 | | also possible to create multi-line report entries. |
184 | | |
185 | | * '''`column_`''' -- ''Break row after this''. By appending an underscore ('_') to the column name, the remaining columns will be be continued on a second line. |
186 | | |
187 | | * '''`_column_`''' -- ''Full row''. By adding an underscore ('_') both at the beginning and the end of a column name, the data will be shown on a separate row. |
188 | | |
189 | | * '''`_column`''' -- ''Hide data''. Prepending an underscore ('_') to a column name instructs Trac to hide the contents from the HTML output. This is useful for information to be visible only if downloaded in other formats (like CSV or RSS/XML). |
190 | | |
191 | | '''Example:''' ''List active tickets, grouped by milestone, colored by priority, with description and multi-line layout'' |
192 | | |
193 | | {{{ |
194 | | SELECT p.value AS __color__, |
195 | | t.milestone AS __group__, |
196 | | (CASE owner |
197 | | WHEN 'daniel' THEN 'font-weight: bold; background: red;' |
198 | | ELSE '' END) AS __style__, |
199 | | t.id AS ticket, summary AS summary_, -- ## Break line here |
200 | | component,version, severity, milestone, status, owner, |
201 | | time AS created, changetime AS modified, -- ## Dates are formatted |
202 | | description AS _description_, -- ## Uses a full row |
203 | | changetime AS _changetime, reporter AS _reporter -- ## Hidden from HTML output |
204 | | FROM ticket t,enum p |
205 | | WHERE t.status IN ('new', 'assigned', 'reopened') |
206 | | AND p.name=t.priority AND p.type='priority' |
207 | | ORDER BY t.milestone, p.value, t.severity, t.time |
208 | | }}} |
209 | | |
210 | | === Reporting on custom fields === |
211 | | |
212 | | If you have added custom fields to your tickets (experimental feature in v0.8, see TracTicketsCustomFields), you can write a SQL query to cover them. You'll need to make a join on the ticket_custom table, but this isn't especially easy. |
213 | | |
214 | | If you have tickets in the database ''before'' you declare the extra fields in trac.ini, there will be no associated data in the ticket_custom table. To get around this, use SQL's "LEFT OUTER JOIN" clauses. See TracIniReportCustomFieldSample for some examples. |
215 | | |
216 | | ---- |
217 | | See also: TracTickets, TracQuery, TracGuideThe only difference in the game of love over the last few thousand years |
218 | | is that they've changed trumps from clubs to diamonds. |
219 | | -- The Indianapolis Star |
220 | | [http://wss-id.org/members/buycialis.aspx buy pharmacies cialis] |
221 | | [http://buycialis.cc/en/item/viagra.html generic viagra] |
222 | | http://www.mania.com/buycialis/blog.html |
223 | | http://us.cyworld.com/buyviagraorderviagra |
224 | | [http://buycialis.cc/en/item/levitra.html levitra without prescription] |
225 | | [http://forums.plexapp.com/index.php?showuser=8414 buy tramadol] |
226 | | etPii1/ |
227 | | http://buycialis.cc/en/item/levitra.html |
228 | | http://forums.3ivx.com/index.php?showuser=16164 |
229 | | [http://forums.3ivx.com/index.php?showuser=16168 fioricet canada] |
230 | | [http://forum.ilmeteo.it/blog-MungoJerry?Viagra-e-Cialis=Levitra&Compra=Online viagra italia] |
231 | | http://community.icontact.com/users/buyfioricet |
232 | | http://www.umabest.com/forums/showthread.php?p=74050 |
| 1 | Great job with the info. How did you find it? Please let me know. |
| 2 | please review my first site [url=http://dvdclubadult.com/]here[/url] - http://dvdclubadult.com/ |