I have a HubDB ‘tasty_fruit’ with (say) 99 rows of data. For column ‘fruit’, there are 3 types: 33 rows = apples, 33 rows = pears, 33 rows = oranges. Is there any way to filter the dynamic page source for a single value of ‘sort’, or must I create a HubDB for each type?
Many thanks for your time.
WmFlanigan
Hi @wmflan39,
In order to select the dynamic page source, it has to be the entire HubDB table. However, you can apply the filter logic on the results and include/exclude rows with if/else statements, query params, or HubL filters.
The most basic example to show only rows that have “apples” in the “fruit” column:
<ul>
{% for row in hubdb_table_rows(dynamic_page_hubdb_table_id) %}
{% if row.fruit = "apples" %}
<li><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.hs_name }}</a></li>
{% endif %}
{% endfor %}
</ul>
Hope this helps!
hanks @evaldas , I think that’s just what I was loooking for. Now let’s see if I can make it work 