<?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: Add HubDB column data in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539474#M26441</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/60000"&gt;@ben-duchy&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;This should be the correct answer. I misread and thought you were retrieving a single row.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Dec 2021 10:27:12 GMT</pubDate>
    <dc:creator>Teun</dc:creator>
    <dc:date>2021-12-09T10:27:12Z</dc:date>
    <item>
      <title>Add HubDB column data</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/538889#M26422</link>
      <description>&lt;P&gt;Hello, does anyone know how I can add the contents of a column pulled from HubDB?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column called 'price' and I want to add up all the rows that are still available for purchase for example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set price = hubdb_table_rows(1234567) %}

{% set total_price = price | rejectattr ("price","equalto",blank) | selectattr ("status","equalto","Available") %}&lt;/LI-CODE&gt;&lt;P&gt;The above is filtering the data as needed, but I just can't figure out the total value from this filter. For example each item is £10 and 4 are left to be sold. I need the total to show that the total value of items left to sell is £40.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 17:10:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/538889#M26422</guid>
      <dc:creator>ben-duchy</dc:creator>
      <dc:date>2021-12-08T17:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add HubDB column data</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/538931#M26424</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/60000"&gt;@ben-duchy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you help me out here, please show me the result of&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{{total_price|pprint}}&lt;/LI-CODE&gt;
&lt;P&gt;Just so I know what we are dealing with. If the value of total_price is an object, you should be able to make a simple calculation. Something like:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set total_value = total_price.price * total_price.quantity %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 18:04:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/538931#M26424</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2021-12-08T18:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Add HubDB column data</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539449#M26438</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;Using the below returns&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;(SizeLimitingPyList: [])&lt;/STRONG&gt;&amp;nbsp;but I'm not sure what this means.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{{total_price|pprint}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When entering your example calculation (below) shows errors&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set total_value = total_price.price * total_price.quantity %}&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.jpg" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/55382i6F050868C3C8A4F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="error.jpg" alt="error.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 09:46:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539449#M26438</guid>
      <dc:creator>ben-duchy</dc:creator>
      <dc:date>2021-12-09T09:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Add HubDB column data</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539452#M26439</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My apologies, I don't think my original post was very clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ignoring my example and just thinking generically for a moment, how would you filter out just that 1 column in order to add up the contents? Would the column need to be set as a number?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 09:51:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539452#M26439</guid>
      <dc:creator>ben-duchy</dc:creator>
      <dc:date>2021-12-09T09:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add HubDB column data</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539459#M26440</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/60000"&gt;@ben-duchy&lt;/a&gt;&amp;nbsp;(and&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;) just going to add my two pence here. It looks like 'total_price' is a list of rows from your HubDB, so you need to loop over them and add the value of the price column to a variable set outside of said loop. Something like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set price = hubdb_table_rows(1234567) %}
{% set price_rows = price | rejectattr ("price","equalto",blank) | selectattr ("status","equalto","Available") %}
{% set totalPrice = {'value': 0} %}
{% for row in price_rows %}
  {# using cut and int here to make sure the value is just an integer #}
  {% do totalPrice.update({'value': totalPrice.value + row.price|cut('£')|int}) %}
{% endfor %}
&amp;lt;p&amp;gt;Total value: £{{totalPrice.value}}&amp;lt;/p&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 09 Dec 2021 10:07:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539459#M26440</guid>
      <dc:creator>piersg</dc:creator>
      <dc:date>2021-12-09T10:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Add HubDB column data</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539474#M26441</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/60000"&gt;@ben-duchy&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;This should be the correct answer. I misread and thought you were retrieving a single row.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 10:27:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539474#M26441</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2021-12-09T10:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add HubDB column data</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539505#M26443</link>
      <description>&lt;P&gt;That's perfect, thanks&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/103660"&gt;@piersg&lt;/a&gt;&lt;/P&gt;&lt;P&gt;(...and&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;&amp;nbsp;for your help)&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 11:29:37 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Add-HubDB-column-data/m-p/539505#M26443</guid>
      <dc:creator>ben-duchy</dc:creator>
      <dc:date>2021-12-09T11:29:37Z</dc:date>
    </item>
  </channel>
</rss>

