Linking two HubDB tables

hubdb

#1

I have two HubDB tables: Webinars and Speakers.

In the Webinars table, I have a column called speaker_id which references a row in the Speakers table. When I try to use this in a custom module, it doesn’t work:

<div class="row speaker-block">
{% set speaker_id = dynamic_page_hubdb_row.speaker_id %}
{% if dynamic_page_hubdb_row %}
    <p>I got here with a valid speaker id: {{ speaker_id }}!</p>
    {% set row = hubdb_table_row(673843, {{ speaker_id }}) %}
    <p>{{ row.id }}</p>
{% endif %}
</div>

The row.id ends up being null, even though it exists. If I hard code the speaker_id into the hubdb_table_row args, it works.

Are we not allowed to use variables in calls to hubdb_table_row?

I also tried with hubdb_table_rows using a filter query. Didn’t work there either.

Seems like this is the only way to simulate relations in HubDB. Would make it pretty powerful.


#2

Figured it out!

Silly mistake. Had to remove the {{ }} from the function call.

<div class="row speaker-block">
{% set speaker_id = dynamic_page_hubdb_row.speaker_id %}
{% if dynamic_page_hubdb_row %}
    <p>I got here with a valid speaker id: {{ speaker_id }}!</p>
    {% set row = hubdb_table_row(673843, speaker_id) %}
    <p>{{ row.id }}</p>
{% endif %}
</div>