Merge Field Calculations
Calculations can be done in merge fields. These calculations can be of 2 types; numerical and string. For example;
Numerical;
{ 1 + 2 } produces 3
( 4 * 6 + 10 / 2 } produces 29
String;
( “hello” + “joel” } produces output “hellojoel”.
{ firstname + surname } will replace merge fields and concatenate them; so if firstname is ‘bob’ and surname is ‘smith’ then the output will be ‘bobsmith’.
Calculations that are numerical respect mathematical order of precedence and bracketing. The following mathematical operators are available;
+ addition as in 1 + 2 = 3
– minus as in 1 – 2 = 1
* multiply as in 2 * 2 = 4
/ divide as in 10 / 5 = 2
% modulus as in 10 % 4 = 2
^ power as in 4 ^ 2 = 16
For string calculations only the addition operator is available.