[[PageOutline(2-5,Contents,pullout)]] = Display a table in a wiki page == Description This is a macro that enables you to place tables resulting from SQL queries into a Trac wiki page. It supports the following functionalities: * '''SQLTable''', which returns the result set of the SQL query that follows it. * '''SQLScalar''', which returns the single value that is the result of the SQL query that follows it. Use the '''SQLTable''' macro as follows: {{{ {{{#!SQLTable SELECT COUNT(id) AS "Number of Tickets" FROM ticket }}} }}} The result will be a table displayed in a html page. You can also use wiki markup in the table: {{{ {{{#!SQLTable SELECT '[milestone:' || name || ' ' || name || ']' AS name, due, completed, description FROM milestone }}} }}} Use the '''SQLScalar''' macro: {{{ {{{#!SQLScalar SELECT COUNT(id) AS "Number of Tickets" FROM ticket }}} }}} The result will be a single number. It is similar to, but simpler than, SqlQueryMacro or SqlAlchemyQueryMacro. The main differences are that it has fewer dependencies and only queries the Trac database, rather than requiring you to set up a separate database connection. See also WikiReportMacro. == Bugs/Feature Requests Existing bugs and feature requests for !WikiTableMacro are [report:9?COMPONENT=WikiTableMacro here]. If you have any issues, create a [/newticket?component=WikiTableMacro new ticket]. [[TicketQuery(component=WikiTableMacro&group=type,format=progress)]] == Download Download the zipped source from [export:wikitablemacro here]. == Source You can check out !WikiTableMacro from [/svn/wikitablemacro here] using Subversion, or [source:wikitablemacro browse the source] with Trac. == Installation 1. '''Install''' globally: {{{#!sh sudo pip install svn+https://trac-hacks.org/svn/wikitablemacro/trunk }}} 1. '''Enable''' the plugin by updating TracIni file (`conf/trac.ini`): {{{#!ini [components] wikitable.* = enabled }}} 1. '''Restart''' web server on command line: {{{#!sh sudo /etc/init.d/apache2 restart }}} == Recent Changes [[ChangeLog(wikitablemacro, 3)]] == Author/Contributors '''Author:''' [wiki:optilude] [[BR]] '''Maintainer:''' [[Maintainer]] [[BR]] '''Contributors:''' jun66j5