Harness the power of HubSpot's hubdb tables into your modules.

Assumptions

  • Hubdb table is already created
  • module is created and ready for coding.

Fetch Hubdb table rows

The first step is to grab the ID of the hubdb table storing all of your data. This Id can be easily found in the first column of your portal's hubDB listing.

hubdb id

The Id that I will be using is 5244337

module.html
<!-- variable contains all unfiltered table data -->
{% set data = hubdb_table_rows(5244337) %}


<!-- Loop through each row  -->
{% for row in data %}
  <!-- 
  Print each row
  This is also where you would want to build 
  any cards or start to structure each  data point.
  -->
  {{row|pprint}}
  
{% endfor %}

Each row comes back as an object. So it's easy enough to use dot notation in order to grab any fields that you might need to access. In this case I have 2 columns in my hubdb table: Name and Category.

module.html
<!-- variable contains all unfiltered table data -->
{% set data = hubdb_table_rows(5244337) %}


<!-- Loop through each row  -->
{% for row in data %}
  <article class="basic-card">
    <h3 class="name">{{row.name}}</h3>
    <span class="category">{{row.category}}</span>
  </article>
{% endfor %}

Happy Building!