Skip to main content
Dynamic texts: Calculations

Learn how to use make calculations when generating dynamic texts.

Derek avatar
Written by Derek
Updated over 2 years ago

When we work with processes involving numbers, we often want to perform calculations on them.

For example, when we want to calculate an amount with taxes or when we want to calculate the final price for the provision of different products.

With Parallel you can perform these calculations by applying mathematical operators to dynamic texts. To do this, use the character " | " followed by one of the mathematical operators listed below:

Mathematical operator

Parallel operator

Examples

+

plus

reference = 2

{{ reference | plus: 10 }} o 
{{ 10 | plus: reference }}

Result: 12

-

minus

reference = 2

{{ reference | minus: 10 }} o {{ 10 | minus: reference }}

Result: -8

%

modulo

reference = 3

{{ reference | modulo: 2 }}

Result: 1

x

times

reference = 10

{{ reference | times: 2 }}

Result: 10

/

divided_by

reference = 10

{{ reference | divided_by: 2 }}

Result: 5

abs (|x|)

abs

reference = -2

{{ reference | abs }}

Result: 2

min

at_least

reference = 5

{{ reference | at_least: 10 }}

Result: 10

max

at_most

reference = 5

{{ reference | at_most: 3 }}

Result: 3

Rounds the input down to the nearest whole number.

floor

reference = 5,7

{{ reference | floor }}

Result: 5

Rounds the input up to the nearest whole number.

ceil

reference = 5,7

{{ reference | ceil }}

Result: 6

Rounds a number to the nearest integer or, if a number is passed as an argument, to that number of decimal places.

round

reference = 5,75

{{ reference | round }}

Result: 6

reference = 5,75

{{ reference | round:1 }}

Result: 5,8

Did this answer your question?