rendering1Add my vote for this tag spreadsheet1Add my vote for this tag tables1Add my vote for this tag create new tag
, view all tags


Generate a table matrix from two lists


Generates a matrix in table form. Input are two lists, containing the values for the x and y axis. The lists may be given directly, or as TWiki variables.

In effect, it is similar to a nested use of the FOREACH variable (see TWiki:Plugins.ForEachPlugin), but it will work better for complex substitutions in the cell content, since there is only one "replace". Also, it is easier to use.

Basic Usage

Using the two lists X and Y defined at the end of this topic, we generate an X*Y matrix like this:

  xtext="Eins, Zwei, Drei"
  corner="Letter \ Digit"

This gives

%MATRIX{ x="1,2,3" y="a,b,c" corner="Letter \ Digit" cell="$x:$y" xtext="Eins, Zwei, Drei" ytext="Aa,Bb,Cc"}%

MATRIX Parameters

The parameters prefixed with $ will be provided for the templates, whenever it makes sense from the context. In particular, in the cell template, $x, $y, $xtext and $ytext are available.

Name Description Template variable
x The horizontal values $x
y The vertical values $y
xtext Concomitant for x, can be used in templates $xtext
ytext Concomitant for y, can be used in templates $ytext
corner Text for the upper left corner of the matrix  
xtitle Title template for x Template
ytitle Title template for y Template
cell Template for cell Template
verbatim For debugging. If true, shows generated Twiki markup  

Additionally, to allow delayed rendering of generated TWiki variable calls, the variable $percnt can be used.

  • Set X=1,2,3
  • Set Y=a,b,c


Here is an actual example on our company's platform. For system monitoring, there is a list of systems P09, P11, ... to watch, and for each system there are several aspects like Dumps, tRFC,... . If something is to note about a certain aspect in a certain system, this will be noted in a topic SystUeb(Aspect)(Pxx), where (Aspect) is the aspect, and (Pxx) is the specific system. Clicking on an aspect, gives all notes regarding this aspect. Clicking on a system in the headline on top of the rows, will display all information concerning this particular system.


In the bottom part of the topic, I defined the systems and aspects as TWiki variables:


With these settings, the following code generates above table.

%TABLE{sort="off" headerbg="#E0E0E0" headercolor="#4571D0"}%
  corner="Art \ System"
  ytext = "%ARTENTEXTE%"
  cell="$percntIF{`istopic 'KnowHow.SystUeb$y$x'` 
          else=`<span class='twikiNewLink'><a href='%SCRIPTURLPATH{"edit"}%/KnowHow/SystUeb$y$x?templatetopic=SystUebTemplate' rel='nofollow' title='%MAKETEXT{"Topic $y für $x anlegen"}%'>$x</a></span>`

Plugin Installation & Configuration

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.

  • For an automated installation, run the configure script and follow "Find More Extensions" in the in the Extensions section.

  • Or, follow these manual installation steps:
    • Download the ZIP file from the Plugins home (see below).
    • Unzip MatrixPlugin.zip in your twiki installation directory. Content:
      File: Description:
      data/TWiki/MatrixPlugin.txt This description
      lib/TWiki/Plugins/MatrixPlugin.pm The extension
  • Set the ownership of the extracted directories and files to the webserver user.

  • Plugin configuration and testing:
    • Run the configure script and enable the plugin in the Plugins section.
    • Test if the installation was successful using the example above.

Plugin Info

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Generate a table matrix from two lists

Plugin Author: TWiki:Main.RuedigerPlantiko
Copyright: © 2012 TWiki:Main.RuedigerPlantiko
© 2012 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2012-11-21 (V1.000)
Change History:
2012-11-21: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
TWiki:Plugins.Benchmark: GoodStyle nn%, FormattedSearch nn%, MatrixPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/MatrixPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/MatrixPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/MatrixPluginAppraisal

Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences

Topic attachments
I Attachment History Action Size Date Who Comment
Compressed Zip archivezip MatrixPlugin.zip r2 r1 manage 3.5 K 2012-12-02 - 21:48 RuedigerPlantiko  
PNGpng example.png r1 manage 71.5 K 2012-11-21 - 09:43 RuedigerPlantiko  
PNGpng variables.png r1 manage 25.7 K 2012-11-21 - 11:40 RuedigerPlantiko  
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2013-10-16 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.