Rounding double precision numbers

The article explains the steps to dynamically round double precision values within the HTML of an outbound delivery in Adobe Campaign Standard.

Description description

Environment

Adobe Campaign Standard

Issue/Symptoms

Is it possible to dynamically round double precision values within the HTML of a delivery?

A use case for this would be an abandoned cart email where we want to list off the price of products that a potential customer has in their cart but has not purchased.

Without rounding these values, a double precision value of $9.99 would display along the lines of 9.999999999 in the outbound delivery.

Resolution resolution

Implement the following steps to round double precision numbers:

  1. Use activity query for the desired recipient population in the delivery workflow.

  2. Add the desired fields to be rounded (in this case, @price) in the “Additional Data” tab of the same activity query applied in step one.

  3. Add the rounded expression: Round(@price,2). This will round the value to two decimal places.

  4. Now add a delivery activity to the outbound transition of the activity.

  5. Add a personalization that selects the rounded expression from the inbound target in the delivery activity. Example HTML:

    < td class=“em_side30” width=“110” valign=“top” align=“right”> $ < span class=“nl-dce-field nl-dce-done” id=“span154888084941524” data-nl-expr=“https://experienceleague.adobe.com/context/targetData/expr1?lang=en” data-nl-type=“number” contenteditable=“false”> RoundedPrice (expr1)< /span> < /td>

  6. Save the delivery and send proof to confirm that the values are now displayed as desired.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f