HubDb

Hello

I just have a question: I have two tables and I join them together. the first table can have many children in the second table(one to many), now I want to load the children of each parent(first table row) by parent’s ID. I mean that just the children of each parent load on the second linked page when I click on the parent name.

for example:

First table row: Germany

Second table row: Munich, Dusseldorf,…

I want when I click on Germany just load The Cities of Germany. Not all the rows in the second table.

Would you please help me?

Thanks

Maryam

Does the child table have a column that states the parent’s row ID so you can match cities with countries? If so, you would just filter by that, e.g.

{% if dynamic_page_hubdb_row and row.hs_child_table_id %}
 {% set child_table = hubdb_table_rows(row.hs_child_table_id, "&country_id="~row.id ) %}
 {% for row in child_table %}
 {{row}}
 {% endfor %}
{% endif %}