Weagree’s contract automation wizard permits automatic calculations of values and inserting the results into the contract text. Also, it is possible to force a number formatting (it reinforces consistency and permits exporting of entered or calculated data to external IT systems and into the CLM).
TABLE OF CONTENTS
A. Calculating a value
B. Forcing an input format
C. Formatting a number
A. CALCULATING A VALUE
Calculations are performed with the [calc] tag The [calc] tag must contain a formula with all the required variables for the calculation. In the questionnaire’s WYSIWYG view and generated document, the tag is replaced by the result.
Q&A answers may be used as variables. Therefore, a calculation tag may contain global questions and (for values used in the same template component, like a contract clause) local questions. Similarly, any calculation tag may be (re)used within another such tag in the same template component.
Notes:
- Like in mathematical formulae, any round brackets/parentheses ( ) used within the calculation tag determine the order of the calculation.
- An edit question or choice question can be tagged exclusively within the calculation tag. In that case, the answer to that question will not be inserted into the contract, but only be used in the calculation.
- Using brackets to open and close the calculation part of the tag permits using decimals with a full stop.
- It is possible to format the calculated value (see section C below).
Calculation tag structure:
[calc.<tag name>.(<calculation>)]
If formatting requirements apply to the calculation result:
[calc.<tag name>.(<calculation>).<formatting parameter>]
Examples of a simple calculation:
Sum ( + ):
[calc.Example A sum.(200+[edit.Amount 1]+[edit.Amount 2]+[gq.Value entered elsewhere])]
Example – Deduct ( – ):
[calc.Example A deduction.(200-[edit.Amount 1]-[edit.Amount 2]-[gq.Value entered elsewhere])]
Example – Divide ( / ):
[calc.Example A divide.(200/[edit.Amount X])]
Example – Multiply ( * ):
[calc.Example A multiply.(200*[edit.sum1])]
Example – Combine: sum and divide ( + and / ):
[calc.Example A sum and divide.((200+[edit.sum1]+[edit.sum2]+[gq.sumglobal])/2)]
Example – Combine a nested calculation and sum (calculation within a calculation and + ):
[calc.Calculate with existing value.(200+[calc.Example A divide])]
Possible other parameters in a calc-tag are:

Example:
[calc.Example A.(([edit.value1] +([edit.value2] * 3)/2))]
[calc.const.(5000)]
Reusing an existing calculation:
[calc.Example B.([calc.Example A]+2)]
[calc.Example C.([calc.const]+[calc.Example B])]
When inserting the tag (in the template creation tool), regardless of the applicable template language or culture, any decimals must be separated by a full stop ( . ):
[calc.Example D.([calc.Example A]+2.5)]
B. FORCING AN INPUT FORMAT
The editable field settings permit forcing the user to enter a number as either an integer (natural number, without decimals) or a numeral with decimals. This prevents the use of letters or other non-numerals, including manual thousand-separators or spaces. Exact formatting can be preconfigured in the calculation tag (see below).
C. FORMATTING A NUMBER
Numbers in contracts should feature correct and consistent use of commas and full stops to separate thousands and decimals. This applies both to the output in the generated document and values stored in the CLM. There is some risk involved in relying fully on user input here, however. At the same time, if it must be possible to export such stored values to an external system, this likely requires a plain number format that does not support or distinguish between commas and full stops.
Both issues can be solved by, on the one hand, forcing the input format as described in section B above and, on the other hand, configuring the calculation tag to apply specific formatting to the entered value. This formatting will only be applied in ‘post-processing’, when the value is retrieved to generate the questionnaire’s WYSIWYG view or when generating a document. A plain number (without or without decimals) will be stored in the Weagree Wizard’s database, ready for export.
Formatting is defined by a suffix that follows the formula, such as in this example:
[calc.Amount of the loan.([edit.Principal loan amount]).#,###.##]
The following number-formatting examples deliver the indicated results in the contract:

0 = insert either a value or a 0 on that position
The above example assumes that the culture (language) of the template is set to English (United States). Otherwise, the result will be different, depending on the applicable culture. If an amount must not be rounded but truncated, use the Truncate parameter in the calculation part.
Examples (all with template language English (U.S.)):
[calc.Example 1.(1000).#,###.##]
Result in contract: 1,000
[calc.Example 2.(1000).0,000.00]
Result in contract: 1,000.00
[calc.Example 3.(1).0,000.00]
Result in contract: 0,001.00
[calc.Example 4.(1).#,###.##]
Result in contract: 1
With truncation:
[calc.Example 4 truncated.(Truncate(8315.60)).#,###]
Result in contract: 8,315