Calc Macro

Version 13.1 by Thomas Mortagne on 2011/10/28 09:25

calculatorPerform simple calculations and sums in Wiki tables
TypeXAR
Category
Developed by

Ludovic Dubost (XWiki SAS)

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

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

ParameterDescriptionPossible valuesDefault value
formulaFormula 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 columnsmultiplication of the 2 columns to the left of the current column
formatDisplay format of the resulting calculation. This uses DecimalFormat from java0.00 Euros0.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" /}}

sum macro

ParameterDescriptionPossible valuesDefault value
typeVertical or Horizontal sum. Currently only vertical is supportedcolnone
formatDisplay format of the resulting sum. This uses DecimalFormat from java0.00 Euros0.00

Sample:

|=Description|=Number of days
|Project Manager|2.5
|Designer|1
|=Total|={{sum type="col" format="0.0 days" /}}

summary macro

ParameterDescriptionPossible valuesDefault value
typeHeading or Aggregate groupingheading or columnheading
titleTitle line to use for the summary table A standard title line is used by default
summarytitleSummary title to use for the summary table for the full summary line The text "Total" is used by default
format1Display format of the first element of the grouping. This uses DecimalFormat from java0.00 days0.00
format2Display format of the second element of the grouping. This uses DecimalFormat from java0.00 Euros0.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

Get Connected