HubDB - Print joined table data of a specific row

SOLVE
Highlighted
Regular Contributor

Hello.
I have two tables that I connected with Foreing ID field.

For one of the tables I've made a listing with dynamic pages.

But when I'm trying to print my joined HubDB table data, it prints all the values for all the rows on a single row page. 
Is it possible to print only joined table data of a specific row on a single row dynamic page?

 

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
Regular Contributor

Suddenly solved this on my own

{% if dynamic_page_hubdb_row %}        
    <h1>{{ dynamic_page_hubdb_row.hs_name }}</h1>
    <h2>{{ dynamic_page_hubdb_row.name }}</h2>
    <h3>{{ dynamic_page_hubdb_row.role }}</h3>
{% for row in dynamic_page_hubdb_row.foreign_row %}
<p>{{ row.hs_id }}</p>
{% endfor %} {% elif dynamic_page_hubdb_table_id %} <ul> {% for row in hubdb_table_rows(dynamic_page_hubdb_table_id) %} <li><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.hs_name }}</a></li> {% endfor %} </ul> {% endif %}

 

 

Reply
0 Upvotes
2 Replies 2
Highlighted
Regular Contributor

Just realized I just printed the data of the table inside the dynamic pages, without any filtering. 

So my code is something like this (I used these two tutorials to creates dynamic pages)
Is there any way to add row filtering?

 

{% if dynamic_page_hubdb_row %}        
    <h1>{{ dynamic_page_hubdb_row.hs_name }}</h1>
    <h2>{{ dynamic_page_hubdb_row.name }}</h2>
    <h3>{{ dynamic_page_hubdb_row.role }}</h3>
     {% for row in hubdb_table_rows(<tableId>) %}
       {% for foreign_row in row.foreign_table %}
  	the name for foreign row {{ foreign_row.hs_id }} is {{ foreign_row.name }}
       {% endfor %}
     {% endfor %}
{% elif dynamic_page_hubdb_table_id %}
    <ul>
    {% for row in hubdb_table_rows(dynamic_page_hubdb_table_id) %}
        <li><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.hs_name }}</a></li>                
    {% endfor %}
    </ul>
{% endif %}
Reply
0 Upvotes
Highlighted
Regular Contributor

Suddenly solved this on my own

{% if dynamic_page_hubdb_row %}        
    <h1>{{ dynamic_page_hubdb_row.hs_name }}</h1>
    <h2>{{ dynamic_page_hubdb_row.name }}</h2>
    <h3>{{ dynamic_page_hubdb_row.role }}</h3>
{% for row in dynamic_page_hubdb_row.foreign_row %}
<p>{{ row.hs_id }}</p>
{% endfor %} {% elif dynamic_page_hubdb_table_id %} <ul> {% for row in hubdb_table_rows(dynamic_page_hubdb_table_id) %} <li><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.hs_name }}</a></li> {% endfor %} </ul> {% endif %}

 

 

Reply
0 Upvotes