Calc Macro
Version 12.1 by Thomas Mortagne on 2011/10/27 19:24
Perform simple calculations and sums in Wiki tables |
Type | wikimacro |
Category | |
Developed by | Ludovic Dubost (XWiki SAS) |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
These macros allow to do simple calculation and sums in Wiki tables. It also allows to generate summary tables from multiple tables.
calc macro
Parameter | Description | Possible values | Default value |
---|---|---|---|
formula | Formula to use for the calculation in velocity | $B * $C or $row.get(2) * $row.get(3) for rows or $b*$c or $col.get(2) * $col.get(3) for columns | multiplication of the 2 columns to the left of the current column |
format | Display format of the resulting calculation. This uses DecimalFormat from java | 0.00 Euros | 0.00 |
Sample:
|=Desc|=Days|=Price|=Total HT|=Total TTC
|Test|3.5|600|{{calc formula="$B*$C" format="0.00 Euros" /}}|{{calc formula="$D*1.196" format="0.00 Euros" /}}
|Test|3.5|600|{{calc formula="$B*$C" format="0.00 Euros" /}}|{{calc formula="$D*1.196" format="0.00 Euros" /}}
sum macro
Parameter | Description | Possible values | Default value |
---|---|---|---|
type | Vertical or Horizontal sum. Currently only vertical is supported | col | none |
format | Display format of the resulting sum. This uses DecimalFormat from java | 0.00 Euros | 0.00 |
Sample:
|=Description|=Number of days
|Project Manager|2.5
|Designer|1
|=Total|={{sum type="col" format="0.0 days" /}}
|Project Manager|2.5
|Designer|1
|=Total|={{sum type="col" format="0.0 days" /}}
summary macro
Parameter | Description | Possible values | Default value |
---|---|---|---|
type | Heading or Aggregate grouping | heading or column | heading |
title | Title line to use for the summary table | A standard title line is used by default | |
summarytitle | Summary title to use for the summary table for the full summary line | The text "Total" is used by default | |
format1 | Display format of the first element of the grouping. This uses DecimalFormat from java | 0.00 days | 0.00 |
format2 | Display format of the second element of the grouping. This uses DecimalFormat from java | 0.00 Euros | 0.00 |
In mode "heading", elements are grouped by the heading of the section in which the table is. The second and third column values of the last row of each table is used for the aggragation as shown in the sample.
In mode "column", elements are grouped by the value of the first column. The second and third column values of each row of each tables are aggregated except the last row of each table.
Sample:
{{summary format1="0.0 days" format2="0 Euros"/}}
Prerequisites & Installation Instructions
Import the XAR and visit pages Macros.Calc Macros.Sum and Macros.Summary