# HubDB row show output in module

**URL:** <https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276>\
**Category:** CMS Development\
**Tags:** hubdb, enterprise\
**Created:** [December 15, 2022, 9:30am UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276 "2022-12-15T09:30:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke-Simp](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/luke-simp/32/74544_2.png) [@Luke-Simp](https://community.hubspot.com/u/Luke-Simp)\
**Post date:** [December 15, 2022, 9:30am UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/1 "2022-12-15T09:30:22Z")

</div>

Seasons greetings! 🎄

I’m a marketer trying to code without much knowledge/skills but getting there with the help of hubspot support and this great community!

At the moment I’m trying to create/alter a custom module so that I can pull in info from HubDB Tables. Was amazed when I found out this was built into the module builder as hubdbrow\_field.

Working in Higher Education and my aim is to display course information in a little box for quick reference e.g. course code, duration, locations, etc. I feel like I’m close to a solution but probably doing something dumb so it doesn’t work. Read a lot of the documentation but I’m pretty bad at understanding so just having a crack.

Have started with:

```lia-code-sample
<div>
{{ module.hubdbrow_field }}
<p>Delivery Locations:{% for course_delivery_locations in module.hubdbrow_field %} {{ course_delivery_locations.name }} {% endfor %}</p>
</div>

```

And the settings on the sidebar thing are:

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/8/68ed46f3283be7cf24121ac094c639d8f73287a5.png)

which is displaying as:

So I just want to use the highlighted part and have it display as:

Delivery Locations: Sydney, Melbourne, Brisbane, etc.

Any advice is appreciated. Thanks in advance for your help.

---

<div class="post-metadata">

**Author:** ![MBERARD](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mberard/32/61390_2.png) [@MBERARD](https://community.hubspot.com/u/MBERARD)\
**Post date:** [December 15, 2022, 9:46am UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/2 "2022-12-15T09:46:46Z")

</div>

Hi @Luke-Simp ,

You’re not far from getting your code displaying what you need! Your problem is that _course\_delivery\_locations_ is referecing values from a joined table. As you can add multiple location the values are stored in an array. You need to loop thrue the array to get the name of every location sets.

Can you try the following code?

```lia-code-sample
<div>
 {{ module.hubdbrow_field }}
 <p>Delivery Locations:
 {% for course_delivery_locations in module.hubdbrow_field -%}
 {% for location in course_delivery_locations -%}
 {{ location.name }}{{ ', ' if not loop.last }}
 {%- endfor %}
 {%- endfor %}
 </p>
</div>

```

Bests,

Matthieu

[matthieu.berard@markentive.com](mailto:matthieu.berard@markentive.com)

---

<div class="post-metadata">

**Author:** ![Luke-Simp](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/luke-simp/32/74544_2.png) [@Luke-Simp](https://community.hubspot.com/u/Luke-Simp)\
**Post date:** [December 15, 2022, 10:02am UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/3 "2022-12-15T10:02:04Z")

</div>

Thanks for such a quick reply 😊  
The output I’m now getting is now:  
Delivery Locations: , , ,  
This seems to be a bit closer to what I’m after but should be 7 locations whereas looks like the commas are only indicating four which is strange.  
Extra info: the table being referenced is “campus” and the name of the locations is “name”  
So I also tried:

{{ module.hubdbrow\_field }}

Delivery Locations: {% for course\_delivery\_locations in module.hubdbrow\_field -%} {% for campus in course\_delivery\_locations -%} {{ campus.name }}{{ ', ’ if not loop.last }} {%- endfor %} {%- endfor %}

But this had the same result.

---

<div class="post-metadata">

**Author:** ![MBERARD](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mberard/32/61390_2.png) [@MBERARD](https://community.hubspot.com/u/MBERARD)\
**Post date:** [December 15, 2022, 10:18am UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/4 "2022-12-15T10:18:32Z")

</div>

I think I answered you too quickly and I forgot something… My bad! I updated your last piece of code can you try it?

`Delivery Locations: {% for row in module.hubdbrow_field -%} {% for campus in row.course_delivery_locations -%} {{ campus.name }}{{ ', ' if not loop.last }} {%- endfor %} {%- endfor %}`

---

<div class="post-metadata">

**Author:** ![Luke-Simp](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/luke-simp/32/74544_2.png) [@Luke-Simp](https://community.hubspot.com/u/Luke-Simp)\
**Post date:** [December 15, 2022, 10:26am UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/5 "2022-12-15T10:26:04Z")

</div>

Thanks for the update.  
“Delivery Locations:” this is now the output I’m getting.

---

<div class="post-metadata">

**Author:** ![MBERARD](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mberard/32/61390_2.png) [@MBERARD](https://community.hubspot.com/u/MBERARD)\
**Post date:** [December 15, 2022, 10:33am UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/6 "2022-12-15T10:33:04Z")

</div>

If my answer fulfill your needs you can marked it as a solution 😊

Thanks!

---

<div class="post-metadata">

**Author:** ![Luke-Simp](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/luke-simp/32/74544_2.png) [@Luke-Simp](https://community.hubspot.com/u/Luke-Simp)\
**Post date:** [December 15, 2022, 10:43am UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/7 "2022-12-15T10:43:23Z")

</div>

Sorry Matthieu, actually meant “Delivery Locations:” is what is showing without anything data coming from the table. I feel like its so close though.

Code is:

```lia-code-sample
<div>
 <p>Delivery Locations: {% for row in module.hubdbrow_field -%} 
 {% for campus in row.course_delivery_locations -%} {{ campus.name }}
 {{ ', ' if not loop.last }} {%- endfor %} {%- endfor %}
 </p>
</div> 

```

Thanks for the help so far!

---

<div class="post-metadata">

**Author:** ![MBERARD](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mberard/32/61390_2.png) [@MBERARD](https://community.hubspot.com/u/MBERARD)\
**Post date:** [December 15, 2022, 10:53am UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/8 "2022-12-15T10:53:46Z")

</div>

Again, my bad… if think it’s not my day today 😅  
I need to create some tests to reproduce your use case, I’ll get back to you once I have the right answer!

---

<div class="post-metadata">

**Author:** ![MBERARD](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mberard/32/61390_2.png) [@MBERARD](https://community.hubspot.com/u/MBERARD)\
**Post date:** [December 15, 2022, 1:39pm UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/9 "2022-12-15T13:39:56Z")

</div>

@Luke-Simp I think I find the solution for your problem. Sadly _{{ module.hubdbrow\_field }}_ won’t return value of joined table… My workaround was to get the data of the row form _the hubdb\_table\_rows_ function. By doing that HubSpot return the values from the joined table. Here is my code:

```lia-code-sample
<p>Delivery Locations:
{% for row in module.hubdbrow_field %}
 {%- set row_id = row.id -%}
 {%- set table_id = row.table_id -%}	
 {% for row in hubdb_table_rows(table_id, "&hs_id="~row_id) -%}
	{% for campus in row. course_delivery_locations -%}
	 {{ campus.name }}{{ ', ' if not loop.last }}
	{%- endfor %}
 {%- endfor %}
{%- endfor %}
</p>

```

Hope that this time it will work! 🤞

---

<div class="post-metadata">

**Author:** ![Luke-Simp](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/luke-simp/32/74544_2.png) [@Luke-Simp](https://community.hubspot.com/u/Luke-Simp)\
**Post date:** [December 15, 2022, 10:21pm UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/10 "2022-12-15T22:21:14Z")

</div>

Amazing! You’re a legend. Thanks for your help 🙂

---

<div class="post-metadata">

**Author:** ![Luke-Simp](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/luke-simp/32/74544_2.png) [@Luke-Simp](https://community.hubspot.com/u/Luke-Simp)\
**Post date:** [December 19, 2022, 12:58pm UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/11 "2022-12-19T12:58:24Z")

</div>

Hi Matthieu/anyone else who’s interested.

I’m having some trouble again. Getting an error where I’m getting the below message and now none of the data is displaying. I don’t know if it’s me or what has happened to change it.

Any thoughts? Thanks in advance 🙂

 ![LukeSimp_0-1671454146193.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/3/e35811ad166efc415a3b02bb732d2d1209bc7590.png)

---

<div class="post-metadata">

**Author:** ![MBERARD](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mberard/32/61390_2.png) [@MBERARD](https://community.hubspot.com/u/MBERARD)\
**Post date:** [December 19, 2022, 2:05pm UTC](https://community.hubspot.com/t/hubdb-row-show-output-in-module/71276/12 "2022-12-19T14:05:35Z")

</div>

Hi @Luke-Simp, that’s unfortunate… Does the row that you are referencing still exists? Can you try with a different row?

Matthieu
