%META:TOPICINFO{author="TWikiContributor" date="1289462051" format="1.1" version="$Rev$"}%
---+!! <nop>%TOPIC%
<!--
   Contributions to this TWiki plugin are appreciated. Please update the plugin page at
   http://twiki.org/cgi-bin/view/Plugins/ParseTopicTablesPlugin or provide feedback at
   http://twiki.org/cgi-bin/view/Plugins/ParseTopicTablesPluginDev.
   If you are a TWiki contributor please update the plugin in the SVN repository.
-->
<sticky><div style="float:right; background-color:#EBEEF0; margin:0 0 20px 20px; padding: 0 10px 0 10px;">
%TOC{title="Page contents"}%
</div></sticky>
%SHORTDESCRIPTION%

---++ Introduction

There are times when many simple tables need to be displayed as a single table with specific columns. This plugin simply parses the given topic, extracts the given key/value pairs, and creates a new table dynamically.

The first argument is the source topic. The next argument is the primary key. The dynamic table is sorted on this primary key. The remaining arguments are parsed and displayed in the dynamic table in the order they are listed in the command.

---++ Syntax Rules

<span style="background-color:#f5f5f5">
=%<nop>PARSETOPICTABLES{TOPIC, KEY [, KEY [, KEY...]]}%=
</span>

---++ Example

Given tables like the following in topic !Systems.HardwareDetails:

<verbatim>
| hostname | mailhost |
| location | work room |
| user | admin |
| use | sends mail |
| port | 99Z |
| production | yes |

| hostname | loghost |
| location | closet |
| user | admin |
| use | manages server logs |
| port | 99Z |
| production | yes |

</verbatim>

Write this:

=%<nop>PARSETOPICTABLES{Systems.HardwareDetails, hostname, location, port, production, use}%=

The output is:

<verbatim>
| *hostname* | *location* | *port* | *production* | *use* |
| mailhost | workroom | 99Z | yes | sends mail |
| loghost | closet | 99Z | yes | manages server logs |
</verbatim>

---++ <nop>%TOPIC% Settings

Plugin settings are stored as preferences variables. The following variables are used for this plugin.

   * One line description, is shown in the %SYSTEMWEB%.TextFormattingRules topic:
      * Set SHORTDESCRIPTION = Extract key/value pairs from topics to create a table dynamically

   * Debug plugin: (See output in =data/debug.txt=)
      * Set DEBUG = 0

---++ Plugin Installation Instructions

__Note:__ You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.

   * Download the ZIP file from the plugin web (see below)
   * Unzip ==%TOPIC%.zip== in your TWiki installation directory. Content:
   | *File:* | *Description:* |
   | ==data/TWiki/%TOPIC%.txt== | Plugin topic |
   | ==lib/TWiki/Plugins/%TOPIC%.pm== | Plugin Perl module |
   * Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section.
   * Test if the installation was successful:

%PARSETOPICTABLES{%WEB%.%TOPIC%, hostname, location, port, production, use}%

---++ Plugin Info

|  Plugin Author: | TWiki:Main.MikeEggleston |
|  Copyright: | &copy; 2007, !MikeEggleston <br /> &copy; 2007-2010 TWiki:TWiki.TWikiContributor | 
|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
|  Plugin Version: | 2010-11-10 |
|  Change History: | <!-- versions below in reverse order -->&nbsp; |
|  2010-11-10: | TWikibug:Item6530: Doc improvements |
|  2007-01-12: | Initial Version |
|  CPAN Dependencies: | none |
|  Other Dependencies: | none |
|  Perl Version: | 5.0 |
|  Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% |
|  Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev |

__Related Topics:__ %SYSTEMWEB%.TWikiPreferences, [[%USERSWEB%.TWikiPreferences]], %SYSTEMWEB%.TWikiPlugins
