CINXE.COM
TracReports – WordPress Trac
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><script type="text/javascript" src="/_static/js/bundle-playback.js?v=HxkREWBo" charset="utf-8"></script> <script type="text/javascript" src="/_static/js/wombat.js?v=txqj7nKC" charset="utf-8"></script> <script>window.RufflePlayer=window.RufflePlayer||{};window.RufflePlayer.config={"autoplay":"on","unmuteOverlay":"hidden"};</script> <script type="text/javascript" src="/_static/js/ruffle/ruffle.js"></script> <script type="text/javascript"> __wm.init("https://web.archive.org/web"); __wm.wombat("http://core.trac.wordpress.org/wiki/TracReports","20100703065436","https://web.archive.org/","web","/_static/", "1278140076"); </script> <link rel="stylesheet" type="text/css" href="/_static/css/banner-styles.css?v=S1zqJCYt" /> <link rel="stylesheet" type="text/css" href="/_static/css/iconochive.css?v=3PDvdIFv" /> <!-- End Wayback Rewrite JS Include --> <title> TracReports – WordPress Trac </title> <link rel="search" href="/web/20100703065436/http://core.trac.wordpress.org/search"/> <link rel="help" href="/wiki/TracGuide"/> <link rel="alternate" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracReports?format=txt" type="text/x-trac-wiki" title="Plain Text"/> <link rel="start" href="/wiki"/> <link rel="stylesheet" href="/web/20100703065436cs_/http://core.trac.wordpress.org/chrome/common/css/trac.css" type="text/css"/><link rel="stylesheet" href="/web/20100703065436cs_/http://core.trac.wordpress.org/chrome/common/css/wiki.css" type="text/css"/> <link rel="shortcut icon" href="/web/20100703065436im_/http://core.trac.wordpress.org/chrome/common/trac.ico" type="image/x-icon"/> <link rel="icon" href="/web/20100703065436im_/http://core.trac.wordpress.org/chrome/common/trac.ico" type="image/x-icon"/> <link type="application/opensearchdescription+xml" rel="search" href="/web/20100703065436/http://core.trac.wordpress.org/search/opensearch" title="Search WordPress Trac"/> <script type="text/javascript" src="/web/20100703065436js_/http://core.trac.wordpress.org/chrome/common/js/jquery.js"></script><script type="text/javascript" src="/web/20100703065436js_/http://core.trac.wordpress.org/chrome/common/js/trac.js"></script><script type="text/javascript" src="/web/20100703065436js_/http://core.trac.wordpress.org/chrome/common/js/search.js"></script> <!--[if lt IE 7]> <script type="text/javascript" src="/chrome/common/js/ie_pre7_hacks.js"></script> <![endif]--> <script type="text/javascript"> jQuery(document).ready(function($) { $("#content").find("h1,h2,h3,h4,h5,h6").addAnchor("Link to this section"); }); </script> <script src="https://web.archive.org/web/20100703065436js_/http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script src="https://web.archive.org/web/20100703065436js_/http://static.afterthedeadline.com/atd-jquery/scripts/jquery.atd.textarea.js"></script> <script src="https://web.archive.org/web/20100703065436js_/http://static.afterthedeadline.com/atd-jquery/scripts/csshttprequest.js"></script> <link rel="stylesheet" type="text/css" media="screen" href="https://web.archive.org/web/20100703065436cs_/http://static.afterthedeadline.com/atd-jquery/css/atd.css"/> <script> jQuery(function() { $('textarea').addProofreader(); }); </script> </head> <body> <div id="siteheader"> </div> <div id="banner"> <div id="header"> <a id="logo" href="/web/20100703065436/http://core.trac.wordpress.org/"><img src="/web/20100703065436im_/http://core.trac.wordpress.org/chrome/site/trac-logo.png" alt="WordPress Trac" height="80" width="474"/></a> </div> <form id="search" action="/web/20100703065436/http://core.trac.wordpress.org/search" method="get"> <div> <label for="proj-search">Search:</label> <input type="text" id="proj-search" name="q" size="18" value=""/> <input type="submit" value="Search"/> </div> </form> <div id="metanav" class="nav"> <ul> <li class="first"><a href="/web/20100703065436/http://core.trac.wordpress.org/login">Login</a></li><li><a href="/web/20100703065436/http://core.trac.wordpress.org/prefs">Preferences</a></li><li><a href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracGuide">Help/Guide</a></li><li class="last"><a href="/web/20100703065436/http://core.trac.wordpress.org/about">About Trac</a></li> </ul> </div> </div> <div id="mainnav" class="nav"> <ul> <li class="first active"><a href="/web/20100703065436/http://core.trac.wordpress.org/wiki">Wiki</a></li><li><a href="/web/20100703065436/http://core.trac.wordpress.org/timeline">Timeline</a></li><li><a href="/web/20100703065436/http://core.trac.wordpress.org/roadmap">Roadmap</a></li><li><a href="/web/20100703065436/http://core.trac.wordpress.org/browser">Browse Source</a></li><li><a href="/web/20100703065436/http://core.trac.wordpress.org/report">View Tickets</a></li><li class="last"><a href="/web/20100703065436/http://core.trac.wordpress.org/search">Search</a></li> </ul> </div> <div id="main"> <div id="ctxtnav" class="nav"> <h2>Context Navigation</h2> <ul> <li class="first"><a href="/web/20100703065436/http://core.trac.wordpress.org/wiki/WikiStart">Start Page</a></li><li><a href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TitleIndex">Index</a></li><li><a href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracReports?action=history">History</a></li><li class="last"><a href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracReports?action=diff&version=3">Last Change</a></li> </ul> <hr/> </div> <div id="content" class="wiki"> <div class="wikipage searchable"> <h1 id="TracReports">Trac Reports</h1> <p> </p><div class="wiki-toc"><h4>Table of Contents</h4><ul><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracGuide">Index</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracInstall">Installation</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracInterfaceCustomization">Customization</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracPlugins">Plugins</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracUpgrade">Upgrading</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracIni">Configuration</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracAdmin">Administration</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracBackup">Backup</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracLogging">Logging</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracPermissions">Permissions</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracWiki">The Wiki</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/WikiFormatting">Wiki Formatting</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracTimeline">Timeline</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracBrowser">Repository Browser</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracRevisionLog">Revision Log</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracChangeset">Changesets</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracTickets">Tickets</a></li><li class="False"><a class="missing" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracWorkflow">Workflow</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracRoadmap">Roadmap</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracQuery">Ticket Queries</a></li><li class="active"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracReports">Reports</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracRss">RSS Support</a></li><li class="False"><a class="False" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracNotification">Notification</a></li></ul></div><p> </p> <p> The Trac reports module provides a simple, yet powerful reporting facility to present information about tickets in the Trac database. </p> <p> Rather than have its own report definition format, <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracReports">TracReports</a> relies on standard SQL <tt>SELECT</tt> statements for custom report definition. </p> <blockquote> <p> <strong>Note:</strong> <i>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 <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracQuery">query module</a> 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.</i> </p> </blockquote> <blockquote> <p> <i>You can already completely replace the reports module by the query module simply by disabling the former in <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracIni">trac.ini</a>:</i> </p> <pre class="wiki"> [components] trac.ticket.report.* = disabled </pre><p> <i>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.</i> </p> </blockquote> <p> A report consists of these basic parts: </p> <ul><li><strong>ID</strong> -- Unique (sequential) identifier </li><li><strong>Title</strong> -- Descriptive title </li><li><strong>Description</strong> -- A brief description of the report, in <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/WikiFormatting">WikiFormatting</a> text. </li><li><strong>Report Body</strong> -- List of results from report query, formatted according to the methods described below. </li><li><strong>Footer</strong> -- Links to alternative download formats for this report. </li></ul><h2 id="ChangingSortOrder">Changing Sort Order</h2> <p> Simple reports - ungrouped reports to be specific - can be changed to be sorted by any column simply by clicking the column header. </p> <p> 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. </p> <h2 id="AlternativeDownloadFormats">Alternative Download Formats</h2> <p> Aside from the default HTML view, reports can also be exported in a number of alternative formats. At the bottom of the report page, you will find a list of available data formats. Click the desired link to download the alternative report format. </p> <h3 id="Comma-delimited-CSVCommaSeparatedValues">Comma-delimited - CSV (Comma Separated Values)</h3> <p> Export the report as plain text, each row on its own line, columns separated by a single comma (','). <strong>Note:</strong> Carriage returns, line feeds, and commas are stripped from column data to preserve the CSV structure. </p> <h3 id="Tab-delimited">Tab-delimited</h3> <p> Like above, but uses tabs (\t) instead of comma. </p> <h3 id="RSS-XMLContentSyndication">RSS - XML Content Syndication</h3> <p> 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 <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracRss">TracRss</a> for general information on RSS support in Trac. </p> <hr/> <h2 id="CreatingCustomReports">Creating Custom Reports</h2> <p> <i>Creating a custom report requires a comfortable knowledge of SQL.</i> </p> <p> A report is basically a single named SQL query, executed and presented by Trac. Reports can be viewed and created from a custom SQL expression directly in from the web interface. </p> <p> Typically, a report consists of a SELECT-expression from the 'ticket' table, using the available columns and sorting the way you want it. </p> <h2 id="Ticketcolumns">Ticket columns</h2> <p> The <i>ticket</i> table has the following columns: </p> <ul><li>id </li><li>time </li><li>changetime </li><li>component </li><li>severity </li><li>priority </li><li>owner </li><li>reporter </li><li>cc </li><li>version </li><li>milestone </li><li>status </li><li>resolution </li><li>summary </li><li>description </li></ul><p> See <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracTickets">TracTickets</a> for a detailed description of the column fields. </p> <p> <strong>all active tickets, sorted by priority and time</strong> </p> <p> <strong>Example:</strong> <i>All active tickets, sorted by priority and time</i> </p> <pre class="wiki">SELECT id AS ticket, status, severity, priority, owner, time as created, summary FROM ticket WHERE status IN ('new', 'assigned', 'reopened') ORDER BY priority, time </pre><hr/> <h2 id="AdvancedReports:DynamicVariables">Advanced Reports: Dynamic Variables</h2> <p> For more flexible reports, Trac supports the use of <i>dynamic variables</i> in report SQL statements. In short, dynamic variables are <i>special</i> strings that are replaced by custom data before query execution. </p> <h3 id="UsingVariablesinaQuery">Using Variables in a Query</h3> <p> The syntax for dynamic variables is simple, any upper case word beginning with '$' is considered a variable. </p> <p> Example: </p> <pre class="wiki">SELECT id AS ticket,summary FROM ticket WHERE priority='$PRIORITY' </pre><p> 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 '$'. </p> <p> Example: </p> <pre class="wiki"> http://projects.edgewall.com/trac/reports/14?PRIORITY=high </pre><p> To use multiple variables, separate them with an '&'. </p> <p> Example: </p> <pre class="wiki"> http://projects.edgewall.com/trac/reports/14?PRIORITY=high&SEVERITY=critical </pre><h3 id="SpecialConstantVariables">Special/Constant Variables</h3> <p> There is one <i>magic</i> dynamic variable to allow practical reports, its value automatically set without having to change the URL. </p> <ul><li>$USER -- Username of logged in user. </li></ul><p> Example (<i>List all tickets assigned to me</i>): </p> <pre class="wiki">SELECT id AS ticket,summary FROM ticket WHERE owner='$USER' </pre><hr/> <h2 id="AdvancedReports:CustomFormatting">Advanced Reports: Custom Formatting</h2> <p> Trac is also capable of more advanced reports, including custom layouts, result grouping and user-defined CSS styles. To create such reports, we'll use specialized SQL statements to control the output of the Trac report engine. </p> <h2 id="SpecialColumns">Special Columns</h2> <p> To format reports, <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracReports">TracReports</a> looks for 'magic' column names in the query result. These 'magic' names are processed and affect the layout and style of the final report. </p> <h3 id="Automaticallyformattedcolumns">Automatically formatted columns</h3> <ul><li><strong>ticket</strong> -- Ticket ID number. Becomes a hyperlink to that ticket. </li><li><strong>created, modified, date, time</strong> -- Format cell as a date and/or time. </li></ul><ul><li><strong>description</strong> -- Ticket description field, parsed through the wiki engine. </li></ul><p> <strong>Example:</strong> </p> <pre class="wiki">SELECT id as ticket, created, status, summary FROM ticket </pre><h3 id="Customformattingcolumns">Custom formatting columns</h3> <p> Columns whose names begin and end with 2 underscores (Example: <strong><tt>__color__</tt></strong>) are assumed to be <i>formatting hints</i>, affecting the appearance of the row. </p> <ul><li><strong><tt>__group__</tt></strong> -- Group results based on values in this column. Each group will have its own header and table. </li><li><strong><tt>__color__</tt></strong> -- 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. </li><li><strong><tt>__style__</tt></strong> -- A custom CSS style expression to use for the current row. </li></ul><p> <strong>Example:</strong> <i>List active tickets, grouped by milestone, colored by priority</i> </p> <pre class="wiki">SELECT p.value AS __color__, t.milestone AS __group__, (CASE owner WHEN 'daniel' THEN 'font-weight: bold; background: red;' ELSE '' END) AS __style__, t.id AS ticket, summary FROM ticket t,enum p WHERE t.status IN ('new', 'assigned', 'reopened') AND p.name=t.priority AND p.type='priority' ORDER BY t.milestone, p.value, t.severity, t.time </pre><p> <strong>Note:</strong> A table join is used to match <i>ticket</i> priorities with their numeric representation from the <i>enum</i> table. </p> <h3 id="Changinglayoutofreportrows">Changing layout of report rows</h3> <p> By default, all columns on each row are display on a single row in the HTML report, possibly formatted according to the descriptions above. However, it's also possible to create multi-line report entries. </p> <ul><li><strong><tt>column_</tt></strong> -- <i>Break row after this</i>. By appending an underscore ('_') to the column name, the remaining columns will be be continued on a second line. </li></ul><ul><li><strong><tt>_column_</tt></strong> -- <i>Full row</i>. By adding an underscore ('_') both at the beginning and the end of a column name, the data will be shown on a separate row. </li></ul><ul><li><strong><tt>_column</tt></strong> -- <i>Hide data</i>. 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). </li></ul><p> <strong>Example:</strong> <i>List active tickets, grouped by milestone, colored by priority, with description and multi-line layout</i> </p> <pre class="wiki">SELECT p.value AS __color__, t.milestone AS __group__, (CASE owner WHEN 'daniel' THEN 'font-weight: bold; background: red;' ELSE '' END) AS __style__, t.id AS ticket, summary AS summary_, -- ## Break line here component,version, severity, milestone, status, owner, time AS created, changetime AS modified, -- ## Dates are formatted description AS _description_, -- ## Uses a full row changetime AS _changetime, reporter AS _reporter -- ## Hidden from HTML output FROM ticket t,enum p WHERE t.status IN ('new', 'assigned', 'reopened') AND p.name=t.priority AND p.type='priority' ORDER BY t.milestone, p.value, t.severity, t.time </pre><h3 id="Reportingoncustomfields">Reporting on custom fields</h3> <p> If you have added custom fields to your tickets (experimental feature in v0.8, see <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracTicketsCustomFields">TracTicketsCustomFields</a>), 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. </p> <p> If you have tickets in the database <i>before</i> 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. </p> <hr/> <p> See also: <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracTickets">TracTickets</a>, <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracQuery">TracQuery</a>, <a class="wiki" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracGuide">TracGuide</a> </p> </div> </div> <div id="altlinks"> <h3>Download in other formats:</h3> <ul> <li class="last first"> <a rel="nofollow" href="/web/20100703065436/http://core.trac.wordpress.org/wiki/TracReports?format=txt">Plain Text</a> </li> </ul> </div> </div> <div id="footer" lang="en" xml:lang="en"><hr/> <a id="tracpowered" href="https://web.archive.org/web/20100703065436/http://trac.edgewall.org/"><img src="/web/20100703065436im_/http://core.trac.wordpress.org/chrome/common/trac_logo_mini.png" height="30" width="107" alt="Trac Powered"/></a> <p class="left"> Powered by <a href="/web/20100703065436/http://core.trac.wordpress.org/about"><strong>Trac 0.11.7</strong></a><br/> By <a href="https://web.archive.org/web/20100703065436/http://www.edgewall.org/">Edgewall Software</a>. </p> <p class="right">A <a href="https://web.archive.org/web/20100703065436/http://wordpress.org/">WordPress</a> Project</p> </div> <div id="sitefooter"> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://web.archive.org/web/20100703065436/https://ssl." : "https://web.archive.org/web/20100703065436/http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-52447-27"); pageTracker._trackPageview(); } catch(err) {}</script> </div> </body> </html><!-- FILE ARCHIVED ON 06:54:36 Jul 03, 2010 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 00:01:29 Nov 30, 2024. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). --> <!-- playback timings (ms): captures_list: 0.495 exclusion.robots: 0.027 exclusion.robots.policy: 0.017 esindex: 0.009 cdx.remote: 8.962 LoadShardBlock: 189.244 (3) PetaboxLoader3.datanode: 97.566 (4) PetaboxLoader3.resolve: 210.161 (3) load_resource: 162.796 -->