Accessing HubDB foreign row data

SOLVE
merel
Participant

I used this tutorial to create this page for a client, and I'd like the firm logos to live in a separate database so they can be easily updated, and used in multiple instances. I've created the firm logo database and linked it to the main one via a foreign ID column, but I can't figure out how to access all of the foreign table data. I've tried the nested for loop recommended in How to Join HubDB Tables:

 

{% for row in hubdb_table_rows(<tableId>) %}
  the name for row {{ row.hs_id }} is {{ row.name }}
  {% for foreign_row in row.foreign_table %}
  	the name for foreign row {{ foreign_row.hs_id }} is {{ foreign_row.name }}
  {% endfor %}
{% endfor %}

 And I get this output, with none of the foreign table rows.

I'm pretty new to HubL and databases, so I'm sure there is something basic I am missing. I have poured over the documentation for HubDB and just can't figure it out. Any help would be greatly appreciated!

0 Upvotes
1 Accepted solution

Accepted Solutions
amwilie
Solution
Key Advisor | Elite Partner

Is your foregin id column's internal name foreign_table? If not you need to change foreign_table to the internal name of your foreign id column.

 

{% for foreign_row in row.foreign_table %}

 

Alyssa Wilie

Web Developer at LyntonWeb

If this answer solved your question, please mark it as the solution!

View solution in original post

2 Replies 2
amwilie
Solution
Key Advisor | Elite Partner

Is your foregin id column's internal name foreign_table? If not you need to change foreign_table to the internal name of your foreign id column.

 

{% for foreign_row in row.foreign_table %}

 

Alyssa Wilie

Web Developer at LyntonWeb

If this answer solved your question, please mark it as the solution!

View solution in original post

merel
Participant

I knew there was something simple I was missing! Thanks!

0 Upvotes