CMS Development

JDam
Participant

How to display data from a single row in HubDB

 Hi all,

 

Im new to Hubspot CMS and I'm wondering how to display data from a single row in HubDB. 

 

This is my table:

JDam_0-1639147969541.png

I would like to make an event page with only the data from the first row (and an other event page with just the data of the second row). 


I managed to create a listing page with both rows (and path's) - but I want to show a detailpage when I click the path (with just the data from the row I clicked on).

JDam_1-1639148107208.png

 Can anybody help me with this? Would be awesome!

 

Thanks guys!

Jorg

0 Upvotes
5 Replies 5
webdew
Guide | Diamond Partner
Guide | Diamond Partner

How to display data from a single row in HubDB

Hi @JDam ,

You can follow this snippet
{% set row = hubdb_table_row(<tableId or name>, <rowId>) %}
the value for {{ row.hs_id }} is {{ row.<column name> }}

i have try with my hubdb it is showing single row content only
{% set row = hubdb_table_row(5325434, 624257568157) %}
the value for {{ row.hs_id }} is {{ row.pricing }}


Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.

0 Upvotes
Indra
Guide | Elite Partner
Guide | Elite Partner

How to display data from a single row in HubDB

@dennisedson, thanks for mentioning!

 

@JDam, as @dennisedson is telling I would like to ask you to share your code and a screenshot of your page settings.

 

With the use of dynamic pages, some steps are very important for you to setup like:

  • Setup HubDB on page level underneath the page settings
  • Is your page published, otherwise it won't work

 

I think there are three options which you can choose from:

 

Option 1: Dynamic pages

Dynamic pages are in your case the best way since you only have to build one module to display all data.

If you want to setup pages manually, there is another option you can do.

 

Pros: Your customer can manage all from one HubDB without creating a single page since this need to be setup when setting up the dynamic pages.

Cons: All information has to be storred into the HubDB, you can't just add extra information that can be managed on the event page. You can only add global content but will all be the same for all event pages

 

Option 2: HubDB Row field

Create a custom module. In there you can use the HubDB Row field. This field let you select a certain row of a database. Checkout the product update for more explanation.

 

Pros: You can use it as a custom module on every page, so this doesn't have to be a event page. Also it's possible to add extra content to the event page since this is a 'normal' website page.

Cons: The customer manually needs to create a event page. This is more work. Also you will need to create 2 modules. One for the listing/overview, one for the event page.

 

Option 3: Use the blog functionality

The blog is an easy to use function within HubSpot if you want to use paginations. It's possible within a HubDB, but you need to do a lot of customization. 

 

Pros: Listing and single event page will automatically be creating when creating a new blog/event page

Cons: Is is harder to add custom fields to display onto the listing page, but is possible with Hubl supported tags and export to template content.  


Vet Digital - The Growth Agency | HubSpot Solutions Partner Agency

Did my post solve your question? Help the community by marking it as a solution
JDam
Participant

How to display data from a single row in HubDB

@dennisedson Thanks for replying! I checked out the page and it still isn't working.. When I click the url of the HubDB row (path) I get a 404 page. How do I solve this? Thanks in advance.

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

How to display data from a single row in HubDB

@JDam 

You will probably need to share some code so we can see what you are working with.

@Indra is a brilliant fellow who might be able you help you out further!

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

How to display data from a single row in HubDB

@JDam 

You should check out this document on HubDB Dynamic Pages.  I think this is what you are after.

Also!  Shameless plug, you should come to our workshop next week where we will be working with making dynamic pages and all  things data driven content!

0 Upvotes