We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Jun 24, 2021 9:40 AM
Hi,
I've used this post as a guide
I've managed to get it to work with my main dynamic page. However, the issue I have is when it comes to the child pages.
The way I have my dynamic pages set us is, I have a category page, which links through to individual pages. The individual pages are generated for each row in the DB.
I have a "Presenters" column, which is a multi-selector. How do I only display the name value of a multi-selector from that individual row? Currently, this loops through all of the DB and outputs everything from the DB, rather than for that specific row.
{% for row in hubdb_table_rows(dynamic_page_hubdb_table_id, queryparam) %}
{% for category in row['presenters']%}<span class="presenter">{{ category.name }}</span>, {% endfor %}
{% endfor %}
Solved! Go to Solution.
Jun 28, 2021 11:49 AM
You need to use the dynamic_page_hubdb_row tag, not table_id, to loop through the field to get each selected option.
{% for presenter in dynamic_page_hubdb_row.presenters %}
<span class="presenter">{{ presenter.name }}</span>
{% endfor %}
If this answer solved your question, please mark it as the solution!
Kickstart your success on HubSpot's CMS with a theme by the HubSpot experts at Lynton
Jun 28, 2021 11:49 AM
You need to use the dynamic_page_hubdb_row tag, not table_id, to loop through the field to get each selected option.
{% for presenter in dynamic_page_hubdb_row.presenters %}
<span class="presenter">{{ presenter.name }}</span>
{% endfor %}
If this answer solved your question, please mark it as the solution!
Kickstart your success on HubSpot's CMS with a theme by the HubSpot experts at Lynton
Jun 29, 2021 4:27 AM
Thank you. So simple.
Jun 25, 2021 7:47 AM
Hi @Philip_Marsh ,
"
Use like this dynamic table:
{% if dynamic_page_hubdb_row %}
Detail page
{{ dynamic_page_hubdb_row.name }}
{% elif dynamic_page_hubdb_table_id %}
listing page:
{% for row in hubdb_table_rows(2899020, ""status__eq=Sold"") %}
<span>{{ row.name }}</span>
{% endfor %}
{% endif %}"
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.
Jun 25, 2021 8:12 AM
Hi,
Thanks for the reply. I already have the dynamic template set up. The specific problem I'm having is to display the name value of the multi-select column on the individual pages.
If I just use the below, as you suggest,:
{{ dynamic_page_hubdb_row.presenters }}
The out put is [{id=1, name='Steve', order=0}, {id=2, name='Emma', order=1}]
All I want to display is the name value. Adding .name displays nothing.
{{ dynamic_page_hubdb_row.presenters.name }}
Jun 24, 2021 12:25 PM
Hi @Philip_Marsh, so you want to display a list of all the options that are in your mutli select? You want to use hubdb_table_columns and you have to add .options like so:
{% set presenters = hubdb_table_column(dynamic_page_hubdb_table_id, "presenters").options %}
{% for item in presenters %}
<span class="presenter">{{ presenters.name }}</span>,
{% endfor %}
Jun 25, 2021 4:51 AM - edited Jun 25, 2021 4:59 AM
So, I have a column called presenters with 5 options:
I have a dynamic page set up that turns each row into a page.
In row 1, I have Steve and Emma selected
In row 2, I have Mark and Steve selected
On page 1, I only want to show Steve and Emma, and on Page 2 I want to only show Mark and Steve.
My current code just looped through the entire database and would show as "Steve, Emma, Mark, Steve" regardless of what page you are on. It just loops through the entire database.
I've tried your suggested code but as you said, it only prints out the available options for the multiple selector, not what has been selected