Widget:TableTotal

From Nottinghack Wiki
Jump to navigation Jump to search

This widget can be used to calculate the total of values in a table column and aditionally provide grouped totals based on values in another column.

Using this widget

You can insert a table total with the following wiki code:

{{#widget:TableTotal|tableIndex=0|totalColumn=2|groupColumn=3}}

Parameters

tableIndex
The index of the table on the page containing the values (0 = the first table). Default: 0
totalColumn
The index of the column within the table which contains the values (0 = the first column). Default: 2
groupColumn
The index of the column within the table which contains the group information (0 = the first column). Optional.

Examples

{{#widget:TableTotal|tableIndex=0|totalColumn=2|groupColumn=3}}
Date Item Price Buyer
2014-07-10 Plywoood £22.99 Alice
2014-07-15 M3 Bolts £3.50 Alice
2014-07-15 10 RGB LEDs £7.49 Bob

{{#widget:TableTotal|tableIndex=1}}
Date Item Price Buyer
2014-07-10 Plywoood £22.99 Alice
2014-07-15 M3 Bolts £3.50 Alice
2014-07-15 10 RGB LEDs £7.49 Bob