Two fundamentally different ways to filter search data

First of all, i would like to tell you all that i am not from a CS background. Below is my conjecture after working on my webpage for a while. This might be common knowledge for some or it might be completely wrong. I just thought to write it out to make it clearer for those who are not from this field (like me)

I have a data type User and inside this i have another data type Influencer. I want to filter my search results by state and genre. “State” is an attribute of “User” data type.

Whereas Genre is a list and an attribute of “Influencer” data type.

Here is what my search page looks like:

As you can see, i have set it up to display users even when nothing is typed in or nothing is selected from the dropdown. The way to do this is to define a custom state on your page and set it up on page load. Then in repeating group, use this custom state as data source.
There is this really helpful video on how to do this by @evanlitttle : How To Create A Multi Layer Filter In Your App - Bubble.io Tutorial

So the 2 ways in which we can filter data are:

  1. Filter in the custom state: The filters are applied on the custom state data itself. No filters are needed on the repeating group. This is followed in the video i have linked above. So this filtering can be thought of being done in the backside. The display element is displaying already filtered data.
  2. Filter in the repeating group: The custom state stores full data and the filtering is done at the point of repeating group display. No filters are applied in custom state. Instead filtering is done in the repeating group element. The display element is filtering the data and then displaying it. This really helpful post How to set up a search results page by @boston85719 uses this method to filter data.

Possible PROS and CONS in my opinion:

Method 1:
Pros- If i have multiple display elements on the page all of which have to use the same filtered data, it will be much simpler to filter the source of data. If i put same filters on all display elements, it will become unnecessarily complex and tedious.
Cons- i found it harder to implement in my own case where there is nesting of data types

Method 2:
Pros- If i have multiple display elements which have to display differently filtered data, this is better. It gives much more control on each element and the filters i can apply on it. Also i found it easier to implement in my own case.
Cons- This is not useful in case of a situation like mentioned above in PROS of method 1

4 Likes

You can look into using the list shifter plugin for ‘holding’ filtered data to get a better approach to method 1 as it is kind of a hybrid as the list shifter would function like a custom state but has the ability to use conditionals to change the datasource just like a repeating group.

Also, list shifter has tons of useful functions like process list, as well as an ability to have around 4 different lists held in the same list shifter element as it can hold what is called ‘original list’ ‘shifted list’ ‘custom list’ and ‘processed list’

3 Likes

Will definitely look into it. Thanks for the help! :slight_smile: