CMS Development

ben-duchy
Top colaborador(a)

Edit hubdb filter within the webpage editor

resolver

Is it possible to edit an existing HubDB filter within the page editor? I want to reuse the same module over and over again on different pages, but change the filter settings based on the number of bedrooms, for example 1, 2, 3, 4, 5. See attached.

 

I've created a basic filter which displays any houses with the status column set to 'Available'. See below:

{% set table = hubdb_table_rows(module.table_id, "&status=Available") %}

 

It works perfectly as it's hard coded, however how do I use the choice field so I can control it before pushing live? I've tried the below, but it breaks!

 

{% set table = hubdb_table_rows(module.table_id, "&type={{ module.bedrooms }}") %}

 

Any idea what I'm doing wrong?

 

filter-example.jpg

0 Avaliação positiva
1 Solução aceita
ben-duchy
Solução
Top colaborador(a)

Edit hubdb filter within the webpage editor

resolver

Hi @sharonlicari ,

 

No worries about the delay, I figured it out using the following if statement

 

{% if module.bedrooms =='1'%}
{% set table = hubdb_table_rows(module.table_id, "&status=Available&type=1") %}

{% elif module.bedrooms =='2'%}
{% set table = hubdb_table_rows(module.table_id, "&status=Available&type=2") %}

{% elif module.bedrooms =='3'%}
{% set table = hubdb_table_rows(module.table_id, "&status=Available&type=3") %}

{% elif module.bedrooms =='4'%}
{% set table = hubdb_table_rows(module.table_id, "&status=Available&type=4") %}

{% elif module.bedrooms =='5'%}
{% set table = hubdb_table_rows(module.table_id, '&status=Available&type=5') %}
{% endif %}

Exibir solução no post original

3 Respostas 3
sharonlicari
Gerente da Comunidade
Gerente da Comunidade

Edit hubdb filter within the webpage editor

resolver

Hey @ben-duchy 

 

I apologize for the delay in getting back to you. I am wondering if you were able to resolve this or if you still need assistance on this matter?     

 

Thank you

Sharon


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Avaliação positiva
ben-duchy
Solução
Top colaborador(a)

Edit hubdb filter within the webpage editor

resolver

Hi @sharonlicari ,

 

No worries about the delay, I figured it out using the following if statement

 

{% if module.bedrooms =='1'%}
{% set table = hubdb_table_rows(module.table_id, "&status=Available&type=1") %}

{% elif module.bedrooms =='2'%}
{% set table = hubdb_table_rows(module.table_id, "&status=Available&type=2") %}

{% elif module.bedrooms =='3'%}
{% set table = hubdb_table_rows(module.table_id, "&status=Available&type=3") %}

{% elif module.bedrooms =='4'%}
{% set table = hubdb_table_rows(module.table_id, "&status=Available&type=4") %}

{% elif module.bedrooms =='5'%}
{% set table = hubdb_table_rows(module.table_id, '&status=Available&type=5') %}
{% endif %}

sharonlicari
Gerente da Comunidade
Gerente da Comunidade

Edit hubdb filter within the webpage editor

resolver

I am glad you were able to figure it out 🙂 Thank you for sharing this! 

 

Enjoy the rest of your week 

Sharon 


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Avaliação positiva