CMS Development

ben-duchy
Stratege/Strategin

Multi select filter

lösung

Does anyone know how or if its possible to use the 'selectattr' filter for a multi select in HubDB?

 

For a normal select list I use something like:

{% set housename = house_db | selectattr ("housetype.name","equalto","Buckingham") %}

 

However I have changed the column type in HubDB to be a multi-select and updating the above filter to the below doesn't work. Does anyone know what I need to do?

{% set development = house_db | selectattr ("housetype.name","contains","Buckingham") %}

 

0 Upvotes
1 Akzeptierte Lösung
ben-duchy
Lösung
Stratege/Strategin

Multi select filter

lösung

I've figured it out...

 

I started by calling in the whole table, then using a secondary loop combined with an if condition manged to filter out the relevant rows.

{% set house_type_db = hubdb_table_rows(1234567) %}

 

{% for row in house_type_db %}
  {% for item in row.development %}
    {% if item.name == "Chapelgarth" %}
      <!-- Show slick slider items -->
    {% endif %}
  {% endfor %}
{% endfor %}

 

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
1 Antwort
ben-duchy
Lösung
Stratege/Strategin

Multi select filter

lösung

I've figured it out...

 

I started by calling in the whole table, then using a secondary loop combined with an if condition manged to filter out the relevant rows.

{% set house_type_db = hubdb_table_rows(1234567) %}

 

{% for row in house_type_db %}
  {% for item in row.development %}
    {% if item.name == "Chapelgarth" %}
      <!-- Show slick slider items -->
    {% endif %}
  {% endfor %}
{% endfor %}

 

0 Upvotes