/math 

Syntax:
#[Result Field]%([Format])%=%#%[Operand][Mathematical Operation]%#%[Operand]%,...%;%Comment%

[Result field]:
A whole number identifying the data field of the data record that is to contain the result of the calculation. The existing value of the field is overwritten.

[Format]:
Output format of the result field; you can omit this value (see also the topic Formatting).

[Operand]:
If the operand is preceded by a '#', it can only be a whole number, and identifies the field of the data record that contains the operand for the mathematical operation. If the operand is not preceded by the character '#', it can also be a number containing a decimal point (e.g. "3.14") and can have as many numbers before and after the decimal point as required. The decimal point should always be a ‘.’ If it is written as a comma (‘,’), as is the case in many languages other than English, this will mean your calculations will be incorrect, but you will not be informed of this.

[Mathematical operation]:
The four main mathematical operations are available (plus='+', minus='-', multiplied by='*', divided by ='/').

,.....:
It is possible to make further calculations within the data record. In this case, several calculations are performed in sequence, from left to right.

This processing group can appear in the template file. All calculations are performed before the BOM is output. Old field values are overwritten by the results of the calculations, and can no longer be output. The original values in the text file are retained. This means that, every time you call up the BOM, you have to run all the calculations again.

Example 1: #9(3.6)=#3*#3,#3(3.2)=#9*#3;

Explanation of the Example:
Field 3 contains the result of the calculation for field 3 to the power of 3 – with 3 figures before the decimal point, and 2 after. The result from the previous function, which is in field 9, was used for the calculation, as was the value of field 3. Field 9 contains the square of the result of field 3 - with 3 figures before the decimal point, and 6 after. the old values of fields 3 and 9 are overwritten.

Example 2: #19(.2)=#13*1.15;

Explanation of the example:
Field 19 contains the gross price (including 15% sales tax here) of the net price from field 13. The gross price has, at most, two figures after the decimal point. The old value of field 19 is overwritten.

Example 3: #20(10.6)=#12*#2;

Explanation of the Example:
The total weight of these parts of the data record is calculated by multiplying field 2 (Number) with field 12 (Mass) – and is written to field 20 (User-defined) with 10 figures before the decimal point, and 6 after. The old value of field 20 is overwritten.

For an overview of all the commands available for changing templates for BOM evaluation, please refer to Changing Templates for BOM Evaluation.