CMS Development

josephLayden
Contributeur

Filter HubDB by row using Hubl

Résolue

I am trying to create a listing page that provides a links by state.  The example below, would show all press releases from California tagged 'CA' in the row 'State'

 

{% set table = hubdb_table_rows(679969, queryparam) %}

{% if table == [] %}
<p class='align-center'>Sorry, no listings found for that Search. Try changing your fiter and search again.</p>
{% else %}

{% if row["state"] in table == "CA" %}

<div class="container row-fluid">
  <div class="state-post-listing">
    <ul>	
      <li><a href="{{ row['embed'] }}">{{ row["date"]|datetimeformat('%A %e %B %Y') }}&nbsp;|&nbsp;{{ row['name'] }}&nbsp;|&nbsp;{{ row['state'] }}<a/></li>
    </ul>
  </div>
</div>

{% endif %}


{% endif %}


0 Votes
1 Solution acceptée
josephLayden
Solution
Contributeur

Filter HubDB by row using Hubl

Résolue

I did not have the correct logic.  I fixed the problem by adding 'state=CA' where state is the name/ID of the row and CA is the value i am sorting for.

 

{% set table = hubdb_table_rows(679969, 'state=CA') %}

{% if table == [] %}
<p class='align-center'>Sorry, no listings found for that Search. Try changing your fiter and search again.</p>
{% else %}

{% for row in table %}

<div class="container row-fluid">
  <div class="state-post-listing">
    <ul>	
      <li><a href="{{ row['embed'] }}">{{ row['date'] }} | {{ row['name'] }} | {{ row['state'] }}<a/></li>
    </ul>
  </div>
</div>

{% endfor %}
{% endif %}

Voir la solution dans l'envoi d'origine

0 Votes
2 Réponses
roisinkirby
Équipe de développement de HubSpot
Équipe de développement de HubSpot

Filter HubDB by row using Hubl

Résolue
0 Votes
josephLayden
Solution
Contributeur

Filter HubDB by row using Hubl

Résolue

I did not have the correct logic.  I fixed the problem by adding 'state=CA' where state is the name/ID of the row and CA is the value i am sorting for.

 

{% set table = hubdb_table_rows(679969, 'state=CA') %}

{% if table == [] %}
<p class='align-center'>Sorry, no listings found for that Search. Try changing your fiter and search again.</p>
{% else %}

{% for row in table %}

<div class="container row-fluid">
  <div class="state-post-listing">
    <ul>	
      <li><a href="{{ row['embed'] }}">{{ row['date'] }} | {{ row['name'] }} | {{ row['state'] }}<a/></li>
    </ul>
  </div>
</div>

{% endfor %}
{% endif %}
0 Votes