<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Currency HubL filters in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Currency-HubL-filters/m-p/1137245#M42745</link>
    <description>&lt;P&gt;Hello Dev community,&lt;/P&gt;&lt;P&gt;We are currently working on updating a custom coded programmable module that is currently used in emails.&amp;nbsp;The purpose of this module is to display currency amounts, that are found in a JSON property used to display multiple items using this unique property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;We deal with different currencies, and our current solution has been working fine but when looking at the CMS Reference documentation, the filter we are using (&lt;A href="https://developers.hubspot.com/docs/reference/cms/hubl/filters#format_currency-deprecated" target="_blank" rel="noopener"&gt;format_currency&lt;/A&gt;) is deprecated. Therefore, I was looking to replace to the new filter &lt;A href="https://developers.hubspot.com/docs/reference/cms/hubl/filters#format_currency_value" target="_blank" rel="noopener"&gt;format_currency_value&lt;/A&gt;, but in doing so, our values are no longer being displayed.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Here is what our simplified module looks like :&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;{% set info = contact.propertyname_json %}&lt;/P&gt;&lt;P data-unlink="true"&gt;{% set info_json = info|fromjson %}&lt;/P&gt;&lt;P data-unlink="true"&gt;{% for account in info_json %}&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;JSON = [{"test1": "300.00", "test2": "500.00", .....}]&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;{% if account.test1 %} Pricing : {{account.test1 |&amp;nbsp;format_currency_value(locale='en-US', currency='USD', maxDecimalDigits=6, minDecimalDigits=0) }}&lt;/P&gt;&lt;P data-unlink="true"&gt;{% end if %}&lt;/P&gt;&lt;P data-unlink="true"&gt;Expectation = Pricing : 300 $&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;What is currently happening is : Pricing :&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;It doesn't show the price amount at all. But if I change to the deprecated filter, it shows the following :&amp;nbsp;Pricing : 300.00 $&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Which is still not correct, as it should be showing the expected value of 300 $.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;From the provided information, can anyone see where we are going wrong and what should be improved or changed to show the required information correctly ?&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Thank you for your assistance,&lt;/P&gt;&lt;P data-unlink="true"&gt;Jason&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Apr 2025 20:17:46 GMT</pubDate>
    <dc:creator>JLetellier</dc:creator>
    <dc:date>2025-04-16T20:17:46Z</dc:date>
    <item>
      <title>Currency HubL filters</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Currency-HubL-filters/m-p/1137245#M42745</link>
      <description>&lt;P&gt;Hello Dev community,&lt;/P&gt;&lt;P&gt;We are currently working on updating a custom coded programmable module that is currently used in emails.&amp;nbsp;The purpose of this module is to display currency amounts, that are found in a JSON property used to display multiple items using this unique property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;We deal with different currencies, and our current solution has been working fine but when looking at the CMS Reference documentation, the filter we are using (&lt;A href="https://developers.hubspot.com/docs/reference/cms/hubl/filters#format_currency-deprecated" target="_blank" rel="noopener"&gt;format_currency&lt;/A&gt;) is deprecated. Therefore, I was looking to replace to the new filter &lt;A href="https://developers.hubspot.com/docs/reference/cms/hubl/filters#format_currency_value" target="_blank" rel="noopener"&gt;format_currency_value&lt;/A&gt;, but in doing so, our values are no longer being displayed.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Here is what our simplified module looks like :&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;{% set info = contact.propertyname_json %}&lt;/P&gt;&lt;P data-unlink="true"&gt;{% set info_json = info|fromjson %}&lt;/P&gt;&lt;P data-unlink="true"&gt;{% for account in info_json %}&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;JSON = [{"test1": "300.00", "test2": "500.00", .....}]&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;{% if account.test1 %} Pricing : {{account.test1 |&amp;nbsp;format_currency_value(locale='en-US', currency='USD', maxDecimalDigits=6, minDecimalDigits=0) }}&lt;/P&gt;&lt;P data-unlink="true"&gt;{% end if %}&lt;/P&gt;&lt;P data-unlink="true"&gt;Expectation = Pricing : 300 $&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;What is currently happening is : Pricing :&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;It doesn't show the price amount at all. But if I change to the deprecated filter, it shows the following :&amp;nbsp;Pricing : 300.00 $&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Which is still not correct, as it should be showing the expected value of 300 $.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;From the provided information, can anyone see where we are going wrong and what should be improved or changed to show the required information correctly ?&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Thank you for your assistance,&lt;/P&gt;&lt;P data-unlink="true"&gt;Jason&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2025 20:17:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Currency-HubL-filters/m-p/1137245#M42745</guid>
      <dc:creator>JLetellier</dc:creator>
      <dc:date>2025-04-16T20:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Currency HubL filters</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Currency-HubL-filters/m-p/1137259#M42746</link>
      <description>&lt;P&gt;If you don't want decimals, you should set&amp;nbsp;maxDecimalDigits=0 not&amp;nbsp;&lt;SPAN&gt;maxDecimalDigits=6.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm thinking you might need validate the data. From what I remember,&amp;nbsp;format_currency_value/format_currency can finicky in terms of data being passed in. You can't have any "special characters" like the $. If you do, it won't run the filter and just output the data which is what I'm guessing is happening with format_currency and just failing with format_currency_value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Eg,&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set data= "5,000.000000" %}
{{data|format_currency_value(locale='en-US', currency='USD', maxDecimalDigits=1, minDecimalDigits=1) }}&lt;/LI-CODE&gt;&lt;P&gt;Should return&amp;nbsp;$5,000.0 (1 decimal)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But having a $ will fail and will just return the data value.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set data= "$5,000.000000" %}
{{data|format_currency_value(locale='en-US', currency='USD', maxDecimalDigits=1, minDecimalDigits=1) }}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding a |pprint before your output might help in determing validating the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set data= "$5,000.000000" %}
{{data|pprint }}
{{data|format_currency_value(locale='en-US', currency='USD', maxDecimalDigits=1, minDecimalDigits=1) }}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which will print out "(String: $5,000.000000)".&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Of course, you can also do some preprocessing if you're confident in the data. regex_replace strips out non-numbers (leaving numbers and decimal) then convert it to a float and then format.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set data= "$5,000.000000" %}
{{data|regex_replace("[^0-9.]", "")|float|pprint }}
{{data|regex_replace("[^0-9.]", "")|float|format_currency_value(locale='en-US', currency='USD', maxDecimalDigits=1, minDecimalDigits=1) }}
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2025 20:57:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Currency-HubL-filters/m-p/1137259#M42746</guid>
      <dc:creator>MichaelMa</dc:creator>
      <dc:date>2025-04-16T20:57:15Z</dc:date>
    </item>
  </channel>
</rss>

