CMS Development

subin
Top colaborador(a) | Parceiro Ouro
Top colaborador(a) | Parceiro Ouro

How to filter a HubDB query with a column value

resolver

Hi developers

 

I am developing a listing page using HubDB, 

1.png

 

Here how i can fetch the rows with popularity "popular" with limit 5.

 I have tried some queries but none of them are working, can anyone help me with some queries 

 

Thanks

1 Solução aceita
boulter
Solução
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

How to filter a HubDB query with a column value

resolver
{{ hubdb_table_rows(<tableId>, ‘popularity=<optionid>&limit=5’) }}

where <optionid> is the id of the "popular" or "not popular" option.

 

See https://developers.hubspot.com/docs/cms/hubl/functions#hubdb-table-rows for thorough documentation.

Exibir solução no post original

7 Respostas 7
boulter
Solução
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

How to filter a HubDB query with a column value

resolver
{{ hubdb_table_rows(<tableId>, ‘popularity=<optionid>&limit=5’) }}

where <optionid> is the id of the "popular" or "not popular" option.

 

See https://developers.hubspot.com/docs/cms/hubl/functions#hubdb-table-rows for thorough documentation.

leckerman
Top colaborador(a)

How to filter a HubDB query with a column value

resolver

How do you determine what the <optionid> is for the "popular" or "not popular" dropdown options in the table?

 

I'm trying to create a custom module with “Choice options” that allow you to filter and show options on a page based on what is selected in the HubDB table's column. For example, I want all of our upcoming “Essentials” classes to be listed on a page using a custom module. Not sure I am doing this correctly...

 

I believe the value in the custom module would be something like…

{{ hubdb_table_rows (674971, ‘select_course=<optionid>') }}

 

select_course_dropdown.gif

0 Avaliação positiva
boulter
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

How to filter a HubDB query with a column value

resolver

Sure, you can use the hubdb_table_column hubl tag to get the list of options and then the getOptionByName method to get the option value. See http://designers.hubspot.com/docs/tools/hubdb

0 Avaliação positiva
leckerman
Top colaborador(a)

How to filter a HubDB query with a column value

resolver

Can you tell me what I am doing wrong with these custom module values? How/where do I add what other columns in the table I want to be shown based on the course selected? Is this close? Not working as is...


Value 1:

{{ hubdb_table_column (674971, select_course=getOptionByName("Essentials") }}<h3>{{ row.course_name }}</h3><p><strong>Location:</strong> {{ row.class_location }}<br><strong>Date:</strong> {{row.date|datetimeformat('%A, %B %e, %Y') }}</p>{% endfor %}

 

 

Value 2:

{{ hubdb_table_column (674971, select_course=getOptionByName("Drawings") }}<h3>{{ row.course_name }}</h3><p><strong>Location:</strong> {{ row.class_location }}<br><strong>Date:</strong> {{row.date|datetimeformat('%A, %B %e, %Y') }}</p>{% endfor %}

 

Value 3:

{{ hubdb_table_column (674971, select_course=getOptionByName("Composer") }}<h3>{{ row.course_name }}</h3><p><strong>Location:</strong> {{ row.class_location }}<br><strong>Date:</strong> {{row.date|datetimeformat('%A, %B %e, %Y') }}</p>{% endfor %}

 

0 Avaliação positiva
boulter
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

How to filter a HubDB query with a column value

resolver

Try something like this:

{% set col = hubdb_table_column (674971, <columnId>) %} 

{% set selected_course = col.getOptionByName("Essentials") %}

{{ selected_course }}
 
0 Avaliação positiva
leckerman
Top colaborador(a)

How to filter a HubDB query with a column value

resolver

Is the <columnId> just the name of the column select_course? I can't find id numbers for the table columns. Tried inserting the following into the custom module value choices and then then name of the widget {{ widget.select_course }} into the "Edit" field. Nothing shows up in preview. 

 

Value 1:
{% set col = hubdb_table_column (674971, select_course) %} {% set select_course = col.getOptionByName("Essentials") %}{{ select_course }}<h3>{{ row.course_name }}</h3><p><strong>Location:</strong> {{ row.class_location }}<br><strong>Date:</strong> {{row.date|datetimeformat('%A, %B %e, %Y') }}</p>

 

Value 2:
{% set col = hubdb_table_column (674971, select_course) %} {% set select_course = col.getOptionByName("Drawings") %}{{ select_course }}<h3>{{ row.course_name }}</h3><p><strong>Location:</strong> {{ row.class_location }}<br><strong>Date:</strong> {{row.date|datetimeformat('%A, %B %e, %Y') }}</p>


Value 3:
{% set col = hubdb_table_column (674971, select_course) %} {% set select_course = col.getOptionByName("Composer") %}{{ select_course }}<h3>{{ row.course_name }}</h3><p><strong>Location:</strong> {{ row.class_location }}<br><strong>Date:</strong> {{row.date|datetimeformat('%A, %B %e, %Y') }}</p>

 

0 Avaliação positiva
subin
Top colaborador(a) | Parceiro Ouro
Top colaborador(a) | Parceiro Ouro

How to filter a HubDB query with a column value

resolver

Thanks @boulter this solved my problem, i have directly used the dropdown value

 

ThanksSmiley felizCoração

0 Avaliação positiva