CMS Development

pm8rsh88
Contributor

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE

Hi,

apologises if this is a dumb question, but I'm very tired and have been working on a new FAQ section all day, and I think I'm burnt out. 

 

Set up: 

I have a Parent HudDB, that connects to Child DB's. My FAQ section has 3 dynamic pages:

  1. Page 1 - Main Page that lists different categories (Parent DB)
  2. Page 2 - A page that lists the Frequently asked Questions (Child DB)
  3. Page 3 - A page that has the Answer to the Questions.  (Child DB)

Problem:

What I want to achieve is on Page 3, the Answers page. I want the page to include a list of Questions from the Child DB. I can get this list working on Page 2 using the following code, but for some reason, this code doesn't want to work on Page 3. Any advice on how to do this?

{% set queryparam = "&orderBy=order" %}
{% set rows = hubdb_table_rows(dynamic_page_hubdb_row.hs_child_table_id) %}
{% for row in rows %}

<div>
<div class="faq-btn" data="img{{loop.index}}">
<p><span><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.question }}</a></span>
<img class="plus" src="https://cdn2.hubspot.net/hubfs/4351639/2019/assets-may-2019/plus-bold.svg" alt="plus symbol">
</p>
</div>
</div>

{% endfor %}

The example page is below:

0 Upvotes
1 Accepted solution
pm8rsh88
Solution
Contributor

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE

I figure it out, I had to use

 

 

dynamic_page_hubdb_table_id

 

Instead of 

 

dynamic_page_hubdb_row.hs_child_table_id

 

Full code:

{% set queryparam = "&orderBy=order" %}
{% set rows = hubdb_table_rows(dynamic_page_hubdb_table_id) %}
{% for row in rows %}

<div>
<div class="faq-btn" data="img{{loop.index}}">
<p><span><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.question }}</a></span>
<img class="plus" src="https://cdn2.hubspot.net/hubfs/4351639/2019/assets-may-2019/plus-bold.svg" alt="plus symbol">
</p>
</div>
</div>

{% endfor %}

View solution in original post

8 Replies 8
SJaeger
Contributor | Platinum Partner
Contributor | Platinum Partner

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE

hi,

 

is this value filled on page2/3 

 

dynamic_page_hubdb_row.hs_child_table_id

 

because i think on page 2 u dont have connect to parent first table request

Nothing is impossible
0 Upvotes
pm8rsh88
Contributor

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE

On page 2, it's

{% set rows = hubdb_table_rows(dynamic_page_hubdb_row.hs_child_table_id) %}

And that works, and I'm using the same code on Page 3, as it is, and it no longer works. I assume because when I'm on page 3, it can only check what's in a single row, rather than the entire DB? 

The child database has 2 columns:

  • Question
  • Answer

Page 3 I have displaying a single Question, with the corresponding answer. What I also need is a list of the other Questions in that child database. 

0 Upvotes
SJaeger
Contributor | Platinum Partner
Contributor | Platinum Partner

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE

Hello,

I rather think that he loses his reference to "page2" iwo do you pass parameters in the url? would it be easier to work with url parameters so that you are permanently saved and can also share the links?

Nothing is impossible
0 Upvotes
pm8rsh88
Solution
Contributor

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE

I figure it out, I had to use

 

 

dynamic_page_hubdb_table_id

 

Instead of 

 

dynamic_page_hubdb_row.hs_child_table_id

 

Full code:

{% set queryparam = "&orderBy=order" %}
{% set rows = hubdb_table_rows(dynamic_page_hubdb_table_id) %}
{% for row in rows %}

<div>
<div class="faq-btn" data="img{{loop.index}}">
<p><span><a href="{{ request.path }}/{{ row.hs_path }}">{{ row.question }}</a></span>
<img class="plus" src="https://cdn2.hubspot.net/hubfs/4351639/2019/assets-may-2019/plus-bold.svg" alt="plus symbol">
</p>
</div>
</div>

{% endfor %}
SJaeger
Contributor | Platinum Partner
Contributor | Platinum Partner

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE
  1. then mark als answered 😉 so every one see your solution
Nothing is impossible
pm8rsh88
Contributor

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE

Done. I also edited it to include the full example

0 Upvotes
himanshurauthan
Thought Leader | Elite Partner
Thought Leader | Elite Partner

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE

Hello @pm8rsh88,

 

Please check your page-2 and page-3 specifications, both should be the same.

If they are same then please let me know what error you are getting on implementing the code for page-3.

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Upvotes
pm8rsh88
Contributor

HubDB - Listing rows on a dynamic page (Child Table)

SOLVE

Hi, sorry, what do you mean by 


@himanshurauthan wrote:

Hello @pm8rsh88,

 

Please check your page-2 and page-3 specifications, both should be the same.


Thanks,

0 Upvotes