<?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 Re: Problems formatting and performing a calculation in a budget template in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Problems-formatting-and-performing-a-calculation-in-a-budget/m-p/1177443#M43577</link>
    <description>&lt;P&gt;Instead of doing all the replace filters, have you tried using the format_currency_value filter? It supports locales which includes the&amp;nbsp;Brazilian Real&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{{ valor | format_currency_value(locale="pt-BR") }}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for your specific issue, you would need to do a bit of debugging. What is the value being pushed into your replace filters? You might need to just output every step to see what is causing the issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While Hubl is based off of jinja, I don't believe it supports the .format function from jinja (in favor of their own custom filters and functions).&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jul 2025 20:36:22 GMT</pubDate>
    <dc:creator>MichaelMa</dc:creator>
    <dc:date>2025-07-16T20:36:22Z</dc:date>
    <item>
      <title>Problems formatting and performing a calculation in a budget template</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Problems-formatting-and-performing-a-calculation-in-a-budget/m-p/1177387#M43573</link>
      <description>&lt;P&gt;Hello everyone...&lt;BR /&gt;&lt;BR /&gt;I'm editing a budget template, and the main table needs to perform the following calculation:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ViniBernardo_0-1752689388017.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/150881i9555390281D60410/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ViniBernardo_0-1752689388017.png" alt="ViniBernardo_0-1752689388017.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Assinatura Anual" field: Finds the "Quantity" field of the line items, adds them (if there's more than one), and multiplies them by 12 (to represent per year);&lt;BR /&gt;"Valor por Assinatura" field: Pulls and adds the "Net Price" field of the line items;&lt;BR /&gt;"Investimento Anual" field: Finds the "Net Price" field of the line items, adds them (if there's more than one), and multiplies them by 12.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I tried to configure something like the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;"&amp;lt;!-- Tabela de valores --&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;div class="container--content"&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;table class="tabela"&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;thead&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;tr style="background-color: #f9b915;"&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;th&amp;gt;Assinaturas Anual&amp;lt;/th&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;th&amp;gt;Valor por Assinatura&amp;lt;/th&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;th&amp;gt;Investimento Mensal&amp;lt;/th&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;th&amp;gt;Investimento Anual&amp;lt;/th&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;th&amp;gt;Setup&amp;lt;/th&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;/tr&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;/thead&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;tbody&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% for item in line_items %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;tr&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;td&amp;gt;{{ item.quantity * 12 }}&amp;lt;/td&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;lt;td&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% set valor = item.price|float %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;R$ {{ "{:,.2f}".format(valor)|replace(",", "X")|replace(".", ",")|replace("X", ".") }}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;/td&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;lt;td&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% if item.hs_post_tax_amount %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% set mensal = item.hs_post_tax_amount|float %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;R$ {{ "{:,.2f}".format(mensal)|replace(",", "X")|replace(".", ",")|replace("X", ".") }}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% else %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;R$ 0,00&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% endif %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;/td&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;lt;td&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% if item.hs_post_tax_amount %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% set anual = (item.hs_post_tax_amount|float * 12)|round(2) %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;R$ {{ "{:,.2f}".format(anual)|replace(",", "X")|replace(".", ",")|replace("X", ".") }}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% else %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;R$ 0,00&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% endif %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;/td&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;lt;td&amp;gt;-&amp;lt;/td&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;/tr&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{% endfor %}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;/tbody&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;/table&amp;gt;"&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;It worked initially, but I can't get it to format to the Brazilian real (R$). It always ends up with a comma at the beginning, or it ignores a trailing 0 or doesn't set the value when it goes over a thousand&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;My guess is that the code is generating the gross value, but I can't find how to make this adjustment.&lt;BR /&gt;&lt;BR /&gt;I really need help&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 18:12:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Problems-formatting-and-performing-a-calculation-in-a-budget/m-p/1177387#M43573</guid>
      <dc:creator>ViniBernardo</dc:creator>
      <dc:date>2025-07-16T18:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problems formatting and performing a calculation in a budget template</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Problems-formatting-and-performing-a-calculation-in-a-budget/m-p/1177443#M43577</link>
      <description>&lt;P&gt;Instead of doing all the replace filters, have you tried using the format_currency_value filter? It supports locales which includes the&amp;nbsp;Brazilian Real&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{{ valor | format_currency_value(locale="pt-BR") }}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for your specific issue, you would need to do a bit of debugging. What is the value being pushed into your replace filters? You might need to just output every step to see what is causing the issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While Hubl is based off of jinja, I don't believe it supports the .format function from jinja (in favor of their own custom filters and functions).&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 20:36:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Problems-formatting-and-performing-a-calculation-in-a-budget/m-p/1177443#M43577</guid>
      <dc:creator>MichaelMa</dc:creator>
      <dc:date>2025-07-16T20:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problems formatting and performing a calculation in a budget template</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Problems-formatting-and-performing-a-calculation-in-a-budget/m-p/1177514#M43578</link>
      <description>&lt;P&gt;Just to add, here is the link to the filter documentation:&lt;BR /&gt;&lt;A href="https://developers.hubspot.com/docs/reference/cms/hubl/filters#format_currency_value" target="_blank"&gt;https://developers.hubspot.com/docs/reference/cms/hubl/filters#format_currency_value&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 03:12:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Problems-formatting-and-performing-a-calculation-in-a-budget/m-p/1177514#M43578</guid>
      <dc:creator>GiantFocal</dc:creator>
      <dc:date>2025-07-17T03:12:10Z</dc:date>
    </item>
  </channel>
</rss>

