Apr 5, 2018 4:13 PM
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') }} | {{ row['name'] }} | {{ row['state'] }}<a/></li> </ul> </div> </div> {% endif %} {% endif %}
Solved! Go to Solution.
Apr 6, 2018 1:03 PM
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 %}
Apr 6, 2018 7:18 AM
Hey @josephLayden does this solution from @TRooInbound help? https://community.hubspot.com/t5/Content-Design-Questions/HubDB-Filtering-based-on-dynamic-page-data...
Apr 6, 2018 1:03 PM
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 %}