Number Transformations

Last updated:

When you need to format a number in a certain way for your communications, you can use the available transformations in Prisma Campaigns. This feature allows you to apply a series of operations to a numeric value, such as handling decimals, displaying as currency, or inserting it into a text string, to name a few examples.

In addition to number transformations, you can also manipulate text, dates, and other types of data based on your needs. One of the advantages of transformations is that they are applied to the value of a field, not to the field itself. The original value is not changed, while the transformed version is only used in the communication.

Typical Use Cases

Transformations can be applied anywhere you would use a variable from the customer or campaign models. This includes the content of a landing page, the funnel, column mappings, and more.

Two typical use cases for number transformations consist of formatting the following values:

  • the customer’s credit score as a decimal with one decimal place
  • the account balance as currency with a dollar sign, two decimals, and the comma as the thousands separator

In both cases, you will need apply the desired function(s) to the variable that contains the number inside curly brackets.

The as_decimal() function is used to convert the number to a decimal, whereas format() specifies the desired format. In the examples below, the pattern %.1f is used to display the number with one decimal place. On the other hand, "$%,.2f" displays the number as currency with a dollar sign, two decimals, and the comma as the thousands separator.

Transforming Numbers in Landing Pages

The following HTML code snippet shows how to format the credit score and account balance variables in a landing page:

<h1>Have Us Call You</h1>
<p>With a credit score of {{customer.credit-score:as_decimal():format("%.1f")}} and an account balance of {{customer.account-balance:as_decimal():format("$%,.2f")}}, you only need one more step to apply for this Loan. Most of your information is ready (you already added for other products). Fill in this form and get ready for your best vacations ever!
<br />
We'll get in touch to help choose the right loan for you.<br />All fields are required unless marked as optional.</p>

The image below shows the result of the transformation. Note that the yellow highlight has been added to emphasize the formatted numbers but it is not included in the HTML code.

Transforming Numbers in the Funnel

To transform a number in a funnel, use the same syntax in the content of a component. The following images show how to format the same variables inside of a message display:

and the result in the funnel itself:

Transforming Numbers in Column Mappings

Column mappings allow you to transform the records 1) from a CSV file before importing it into or 2) the customer data before exporting it from Prisma Campaigns. To do this, you can apply the desired transformation to the column that contains the number. For example, below you can see how to format the same variables as in the previous cases in an export column mapping:

When used in an export datasync as follows:

the transformed numbers will be displayed in the output file as shown in the image below: