CMS Development

ben-duchy
Top Contributor

Looping a HubL filter

SOLVE

Does anyone know a way how to loop a filter? Is it even possible?

 

I've been tasked with building an internal dashboard for my employer to show a variety of data from 30+ locations.

 

Each filter is complex, but essentially only has a couple of items changed (basic example below). Instead of hardcoding each filter, is it possible to loop it within the module so new filters can be added or removed within the page editor?

 

 

{% set filter_london = table | selectattr ("city.name","equalto","London") | rejectattr ("plot_status.name","equalto","Reserved") %}

{% set filter_manchester = table | selectattr ("site.name","equalto","Manchester") | rejectattr ("plot_status.name","equalto","Reserved") %}

{% set filter_glasgow = table | selectattr ("city.name","equalto","Glasgow") | rejectattr ("plot_status.name","equalto","Reserved") %}

 

 

0 Upvotes
1 Accepted solution
Oezcan
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Looping a HubL filter

SOLVE

Hello @ben-duchy ,

 

of course it is possible 🙂

as my solution I would like to link two pages where you will definitely find a solution to your case.
Click here for the filters supported by HubL. You might want to use one.

Click here for the loops.
And for your case I think you will need this loop.

Click here

 

I hope I could help, best regards,

Özcan

Oezcan Eser Signature

View solution in original post

2 Replies 2
ben-duchy
Top Contributor

Looping a HubL filter

SOLVE

Perfect, thank you @Oezcan 

Oezcan
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Looping a HubL filter

SOLVE

Hello @ben-duchy ,

 

of course it is possible 🙂

as my solution I would like to link two pages where you will definitely find a solution to your case.
Click here for the filters supported by HubL. You might want to use one.

Click here for the loops.
And for your case I think you will need this loop.

Click here

 

I hope I could help, best regards,

Özcan

Oezcan Eser Signature