Basic Math in Templates

Rally extensively supports mathematical operations within templates.


Basic operations (add, subtract, multiple and divide) can be completed using the +, -, * and / symbols.



Simple Addition

{ 1 + 1 }

This would output "2" in the document.



Formula With Variable

{ 2 * (purchasePrice + 1) }

This would add 1 to purchase_price and multiple the result by 2. If "purchase_price" were 100, then "202" would be output in the document.



Filters

Filters can also be used to manipulate numerical outputs. For example, if you wanted a number to be output as a currency, you could use the currency filter:

{ purchasePrice | currency }

If purchase price was "100", this would output 100.00 to the document.

More information on what filters are available can be found in: Using Filters When Encoding Documents


Note that to put a dollar sign before the currency, you would need to prepend the curly braces with a dollar sign:

${ purchasePrice | currency }

This would out put "$100.00" if purchase_price was 100.



Assigning Values to Variables

You may also assign values to new variables:

{ totalPrice = purchasePrice * (1 + taxRate) }

This would assign the value of the equation to total_price, which you could then use later in multiple places within the template.



Advanced Operations

Rally can support a wide variety of advanced mathematical operations. Please contact our customer success team if you need help with a specific operation.


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.