<?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 Check if data in HubDB row / column in for loop and output comma once in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Check-if-data-in-HubDB-row-column-in-for-loop-and-output-comma/m-p/813234#M34793</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am pulling from two, separate HubDB Columns:&amp;nbsp;product_type and standard.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;product_type is a single select and standard is a multiselect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there are any rows in "standard", I want to output a comma after product_type. If I put the comma inside of the for loop, it iterates a new comma every time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to output one comma after product_type, even if there are multiple standard items selected (the loop already outputs a comma after these items if there are more than one)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;div class="tagss"&amp;gt;&lt;BR /&gt;{{ row.product_type.name }},&lt;BR /&gt;{% for category in row.standard %}&lt;BR /&gt;{{ category.name }}{% if not loop.last %},{% endif %}&lt;BR /&gt;{% endfor %}&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;In my screenshot example, you'll see a comma after "Modules". Because there is no "standard" selected in HubDB, I don't want that comma to output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jun 2023 17:19:14 GMT</pubDate>
    <dc:creator>marenhogan</dc:creator>
    <dc:date>2023-06-28T17:19:14Z</dc:date>
    <item>
      <title>Check if data in HubDB row / column in for loop and output comma once</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Check-if-data-in-HubDB-row-column-in-for-loop-and-output-comma/m-p/813234#M34793</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am pulling from two, separate HubDB Columns:&amp;nbsp;product_type and standard.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;product_type is a single select and standard is a multiselect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there are any rows in "standard", I want to output a comma after product_type. If I put the comma inside of the for loop, it iterates a new comma every time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to output one comma after product_type, even if there are multiple standard items selected (the loop already outputs a comma after these items if there are more than one)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;div class="tagss"&amp;gt;&lt;BR /&gt;{{ row.product_type.name }},&lt;BR /&gt;{% for category in row.standard %}&lt;BR /&gt;{{ category.name }}{% if not loop.last %},{% endif %}&lt;BR /&gt;{% endfor %}&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;In my screenshot example, you'll see a comma after "Modules". Because there is no "standard" selected in HubDB, I don't want that comma to output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 17:19:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Check-if-data-in-HubDB-row-column-in-for-loop-and-output-comma/m-p/813234#M34793</guid>
      <dc:creator>marenhogan</dc:creator>
      <dc:date>2023-06-28T17:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Check if data in HubDB row / column in for loop and output comma once</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Check-if-data-in-HubDB-row-column-in-for-loop-and-output-comma/m-p/813284#M34797</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/46249"&gt;@marenhogan&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% if category.name == null %}, {% endif %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;(you might need play with some options here)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;best,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anton&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 19:18:42 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Check-if-data-in-HubDB-row-column-in-for-loop-and-output-comma/m-p/813284#M34797</guid>
      <dc:creator>Anton</dc:creator>
      <dc:date>2023-06-28T19:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Check if data in HubDB row / column in for loop and output comma once</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Check-if-data-in-HubDB-row-column-in-for-loop-and-output-comma/m-p/813308#M34799</link>
      <description>&lt;P&gt;Thanks for the help!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That didn't work, but it got me headed in the right direction. I updated the code to :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{% if row.standard != null %}, {% endif %}&lt;/PRE&gt;
&lt;P&gt;because I only wanted the comma to output if the standard column was empty. And I need to check the row/column for that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 20:13:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Check-if-data-in-HubDB-row-column-in-for-loop-and-output-comma/m-p/813308#M34799</guid>
      <dc:creator>marenhogan</dc:creator>
      <dc:date>2023-06-28T20:13:30Z</dc:date>
    </item>
  </channel>
</rss>

