Combine multiple formatters in a Merge Template

You cannot combine two formatters in a single merge tag. However, you can add variables to get your desired result.

If you need to add multiple formatters in a single merge tag, you will need to define variables.

For example, if you have a number that you want to round and add currency formatting to, the following will NOT work:

  • {$projectteam_0001|currency_format:”$”|string_format:"%.0f"}

Instead, try the following steps:

Step Description Tag
1 Create a new variable and set the value to your field {assign var=variable1 value=$projectteam_0001}
2 Round the tag using a string_format specifier {assign var=variable1 value=$projectteam_0001|string_format:"%.0f}
3 Output the variable {assign var=variable1 value=$projectteam_0001|string_format:"%.0f}{$variable1}
4 Add the currency format specifier to the variable {assign var=variable1 value=$projectteam_0001|string_format:"%.0f}{$variable1|currency_format:”$”}

In the example above, we first set the new variable, variable1, to a rounded number with no decimals, then we added the currency formatter.

 


Related articles