Multiple Dynamic Filters on a Map?

Hello Gliders :grinning:

I’m scratching my head to have a map with pins filtered by several choices components.

For example a hotel map where the user could filter the hotels by : room type (single, double, triple…), by price ($, $$, $$$) and by stars (1 star hotel, 2 stars, 3, 4, 5), all at the same time.

I inspired myself from the https://concepts.glideapp.io/ app and its Dynamic Filter, but there is only one filter. Is it possible to do that with several filters ?

I tried creating 3 relation columns for each filter, but then I don’t know how to create a final column where each of these columns intersects and only displays the correct information.

Thanks a lot for your help

3 Likes

I modified the concepts app to have 2 levels of filters. First there is the existing Region filter. When you select a Region, it will modify a relation column that is used to show the Divisions within that region. You can then further filter to a specific Division within that Region. It’s a little hard to explain, but I’ll give it my best shot.

  • My first Choice Component List uses the Region column in DynamicFilterChoices. This is the easy part.
  • Next In the DynamicFilterUser sheet, I have columns for Region and Division. This holds the filter selections that the user selected from the two Filter Choice Components.
  • Next I created a tmp-RegionDivision Template Column that joins the Region and Division. I’ll explain the use of this later.
  • Next I created the rel-RegionStateList Relation Column that links the Region Column to the Region Column in the DynamicFilterStateDetails sheet. This relation contains all of the State rows within that selected Region and is used for an inline list with the map style layout that will show all of the states in that region.
  • Next I created a lkup-RegionStateDivision Lookup Column that uses the rel-RegionStateList relation to get an array list of Divisions that are contained in the selected Region’s States.
  • Next I created the rel-RegionDivisionFilter Relation Column which links the array list of Divisions in the lkup-RegionStateDivision Lookup Column to the Divisions Column in the DynamicFilterChoices sheet. This relation gives me all of the Division Choice rows that match all of the Divisions in the State rows from the selected Region This relation is used to build the second Choice Component of Divisions that are contained within the selected Region.
  • Next I created the rel-RegionDivisionStateList relation column. This links the tmp-RegionDivision Template Column created earlier to a tmp-RegionDivision column created in the DynamicFilterStateDetails sheet. This is also uses to create an inline list with the map style layout to list all of the States in the selected Region and Division.
  • Now that I have 2 inline list maps, I change the Visibility on the first one (that uses rel-RegionStateList) to only display if the rel-RegionDivisionStateList is empty. This means that this map will only show only if the relation built from the selected Region and Division DOES NOT have any matching Region and Division combinations in the DynamicFilterStateDetails sheet. If the user changed regions, this updates the Region column, but the Division column still contains a value from the previously selected Division. This means that the Division is not found in the newly selected Region and the relation will be empty.
  • Finally I change the Visibility on the second inline list (that uses rel-RegionDivisionStateList) to only display if the rel-RegionDivisionStateList is NOT empty. This means that this map will show only if the relation built from the selected Region and Division DOES have any matching Region and Division combinations in the DynamicFilterStateDetails sheet.

I hope this makes some sense and I think it’s totally possible with the 3 levels of filters you want. It may take an exponential amount of columns to achieve the same thing I did, but it might also be simpler if your requirement is to have all 3 filters selected before showing results. I hope this helps and gives you ideas. Thanks for the challenge!


7 Likes

WOW. That’s impressive. Thanks Jeff. Though yes it’s a lot of work.

What would be in fact a very basic solution is to add a “ADD” and “OR” feature to the configuration section of the Relation column. That way you can combine and intersect whatever elements you want in a Relation column, saving the hassle of doing all of the work you did.

Relate to items where the value in:
Column A of Sheet Users
Matches the value in:
Column B of Sheet Hotel
AND
Relate to items where the value in:
Column C of Sheet Users
Matches the value in:
Column D of Sheet Hotel

3 Likes

Yes, that would definitely make things a lot simpler.

1 Like

Please @Mark make it happen ! :grinning:

3 Likes

Hi Jeff, how did you get those filters (a. midwest, south, … and then b) mountain, pacific) to click on in there? can’t seem to find that component. Thank you!

That’s the choice component with the horizontal Segmented layout. You can copy the app and see how it’s built.

1 Like

Hi @Jeff_Hager - great build! have you got a link?

Hey @Jeff_Hager, thanks for this very thorough tutorial and the Concepts app, it is very much appreciated !!!
I used your template, customized it and now it’s almost working, except for 2 pesky little bugs :

  1. For some reason, the first row of my data changes every time I pick a new choice. Any ideas of what could be causing this bug?
  2. Also, my dynamic filters don’t always appear on the screen, as you can see here ::

When they do, the first row doesn’t dynamically change with the filters (I think this is because of the first issue: the values of the row keep changing.)

Any ideas of what could be causing those issues ?
Thank you so much for your help !

I’m assuming that you have your tab pointed to the same sheet that contains the restaurants/stores? Are you then displaying that tab in the Detail Style layout? If so, then you are actually displaying the first row from the restaurant/stores sheet and have removed all of the components to replace them with the choice component and the inline list. If you look at the example in my concepts app again, you will see that I have a DynamicFilterUsers sheet that holds all of the user filter selections. I then use those selections to build the relations to the DynamicFilterStateDetails sheet.

If you have a link to your sheet, app, and maybe some screenshots of your data tab an component list, then it would be easier to see what’s happening.

Oh okay, I thought that I didn’t need this tab because I didn’t have a user filter…
So if I understand correctly, I need to put all the filters in a different column?
Cf: picture below

Here is the rest of my setup:

My app link : atyx6.glideapp.io
My sheet link : https://docs.google.com/spreadsheets/d/195jnJSi_MMGUb_-OTEoJX93z6ZSY8ykkaCsjsusHmKs/edit?usp=sharing

No, you still need a separate sheet to hold the user selected filter values. Your setup is actually manipulating the first row of the sheet you are trying to filter. It should be the same as my example. If you don’t want separate filters by user, then you don’t need the email part of DynamicFilterUsers. Just make it one single row instead.

Oh yeah, that’s right ! everything is functioning perfectly now, thanks !

1 Like

What a great info! Thanks @Jeff_Hager :heartbeat:

1 Like

Hey @Jeff_Hager, would love to get some help…

I tried to follow your steps, but got quite lost. :sweat_smile:

So far I’ve gotten up to here:
https://hczml.glideapp.io/ (check out the test tab)

But everything is broken.

By the way, I want to avoid the first step you have in your own, where the user has to tap on a user to enter.

I followed everything as closely as I could, but nothing seems to work…

First of all, my example of clicking on the email to enter is only to emulate logging in and viewing as a different user. This is a public app, so there is no sign in, but I wanted to give the impression of having different view with different users. I had created that example before we were given the use of user specific columns, so the selecting of a user first is mostly irrelevant in my example. The whole app admittedly needs several updates.

User specific columns do make the entire process a lot simpler. I looked at your app, but I do not see a test tab or a hidden tab in the copy I made of it. Where did you get stuck, and what is your ultimate goal for how it should look?

Hey Jeff,

Sorry, I ended up doing away with it… But have now created a copy of the app with a tab on the far right called “filtering”.

You can see it here: kruv5.glideapp.io

I’ve managed to get basic filtering working. But because of the way I’ve set it up, when one user filters, anyone else looking at the app will see the resulting filter as well.

How do I make it so that anyone can filter and not impact everyone else, but without logging in?

You need to set up User Specific columns for this to work without affecting others.

https://docs.glideapps.com/all/reference/privacy-and-per-user-data/user-specific-columns

1 Like

awesome! that worked. thank you!

1 Like