Feb 28, 20196:47 AM - edited Feb 28, 20196:50 AM
Top Contributor
Using HubDB and Custom Modules for the first time
SOLVE
Hi all
It's my first time using HubDB since we just added CMS. I wanted to create a listings page so decided to follow this guide to get an understanding of the basics. I should mention I've barely touched custom modules in the past but understand the functionality changed quite recently, so this guide may be due an update?
I can't seem to get past part 2 on the guide, creating the custom module I face syntax errors preventing me from publishing the module to carry on with following the guide. I wonder if the table needs to be referenced differently as the way custom modules are created changed.
Any help or advice would be greatly appreciated to a novice like myself 🙂
Steve
1.
Error:Cannot resolve property " 1036923}, queryparam) "
2.
Error:1:28TemplateSyntaxException: Error parsing ' hubdb_table_rows({1036923}, queryparam) ': syntax error at position 28, encountered '1036923', expected ':'
3.
Warning:8:0Cannot resolve property 'type' in ''
4.
Warning:9:0Cannot resolve property 'listing_image' in ''
5.
Warning:11:0Cannot resolve property 'listing_price' in ''
6.
Warning:12:0Cannot resolve property 'listing_address' in ''
7.
Warning:13:0Cannot resolve property 'type' in ''
I actually don't think the HubL related to HubDB tables has changed since that article. I may need to go through this tutorial a bit more closely, and you're right that it would be good to include something about custom modules. But I think I see the problem in the screenshot you posted (which is very helpful, thank you). For reference, we have some more examples of calling HubDB tables in this article: https://designers.hubspot.com/docs/tools/hubdb, which I think should make clear what's going on in your example.
Those curly braces aren't actually intended to be included. So you'll want to call your table with something like this:
{% set table = hubdb_table_row(1036923) %}
^This will pull all rows from your table, and you can then loop through them with a for loop like:
{% for row in table %}
{# content here #}
{% endfor %}
...which is what you already have. The reason those warnings like "Cannot resolve property 'type' in ''" is because your table variable itself isn't being created. Once you fix the syntax for creating the table, I'd expect the warnings to go away.
I actually don't think the HubL related to HubDB tables has changed since that article. I may need to go through this tutorial a bit more closely, and you're right that it would be good to include something about custom modules. But I think I see the problem in the screenshot you posted (which is very helpful, thank you). For reference, we have some more examples of calling HubDB tables in this article: https://designers.hubspot.com/docs/tools/hubdb, which I think should make clear what's going on in your example.
Those curly braces aren't actually intended to be included. So you'll want to call your table with something like this:
{% set table = hubdb_table_row(1036923) %}
^This will pull all rows from your table, and you can then loop through them with a for loop like:
{% for row in table %}
{# content here #}
{% endfor %}
...which is what you already have. The reason those warnings like "Cannot resolve property 'type' in ''" is because your table variable itself isn't being created. Once you fix the syntax for creating the table, I'd expect the warnings to go away.
As always, it's simply a missing . or ; or some other thing!
Since posting I had come to the same conclusion, the guide was fine/didn't need updating and I did something wrong, thank you for finding it. Fixing the reference resolved any other warnings following as well.
Maybe it's worth tweaking the guide a little to say {Insert YOUR Table ID and remove these squiggly brackets} instead of {Insert YOUR Table ID}. It should keep others like me (HubL newbies) from making the same mistake.