CMS Development

ben-duchy
Top Contributor

Edit hubdb filter within the webpage editor

SOLVE

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 Upvotes
1 Accepted solution
ben-duchy
Solution
Top Contributor

Edit hubdb filter within the webpage editor

SOLVE

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 %}

View solution in original post

3 Replies 3
sharonlicari
Community Manager
Community Manager

Edit hubdb filter within the webpage editor

SOLVE

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 Upvotes
ben-duchy
Solution
Top Contributor

Edit hubdb filter within the webpage editor

SOLVE

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
Community Manager
Community Manager

Edit hubdb filter within the webpage editor

SOLVE

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 Upvotes