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?
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
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 %}
I am glad you were able to figure it out
Thank you for sharing this!
Enjoy the rest of your week
Sharon