pulling data from multiple columns HubDB HubL

Hello all,

I want to combine dataasets from two columns from a hubDB table and pull the data into a filter. Here is a part of the code that I am using below:

<div id="container">
 {% set table = hubdb_table_rows(2034103) %}
 {% for row in table %}
 <div class="item {% for category in row.filter_item %}{{ category.name|lower|replace('|', '_')|replace('.', '')|replace('/', '_')|replace(' ', '_') }} {% endfor %}">
 <div class="item-inner">
 <h3>{{ row.Name }}</h3>
 <div class="grid-descr">
 {{ row.content }}
 </div>
 <a href="{{ row.button_link }}" target="_blank" class="learn_more_btn">Learn More</a>
 </div>
 </div>
 {% endfor %}
 </div>
</div>

I tried the following for this specific snippet (changes shown in red):

<div class="item {% for category in (row.filter_item or row.molecule_class) %}{{ category.name|lower|replace('|', '_')|replace('.', '')|replace('/', '_')|replace(' ', '_') }} {% endfor %}">

because I wanted to combine the two columns and pull data from both columns.. but it doesn’t seem to be working for me for some reason. Am I doing anything wrong? Is this the correct way to combine columns?

Thanks!

Hey @ziadi

Thank you for the information provided. I’ll tag a few experts
16x16_smiley-happy.png.png

Hey @Dennis-DWFB @DanielSanchez @Anonymous do you have any thoughts you’d like to share with @ziadi

Thank you

Sharon

Hey @ziadi

If you’re just looking to template that class in couldn’t you just use 2 separate loops?

Something like this:

<div class="item {% for category in row.filter_item %}{{ category.name|lower|replace('|', '_')|replace('.', '')|replace('/', '_')|replace(' ', '_') }} {% endfor %} {% for category in row.molecule_class %}{{ category.name|lower|replace('|', '_')|replace('.', '')|replace('/', '_')|replace(' ', '_') }} {% endfor %}">

Ah that just might be the missing link, i will try that! I am not very familiar with HubL or HubDB… appreciate the feedback!