I’ve created a filter tab/screen that allows the logged-in user to select specific filters that involve user data (e.g. gender, salary, employment status) and all the filter options are a dropdown which presents 3-6 options to select. Once the logged-in user picks the filters they want to present in the user results, the screen is linked to a different one that presents all the users that exactly align with the chosen filters (e.g. filters = female, $40K - $60K, full-time job shows all the females working full time, earning 40-60k) this is what I’m struggling to create.
I used a method of creating a “search index” field for each user which contains the relevant data that can be filtered by, as well as a “last filter” field for the logged-in user which creates the custom filter search. The problem I’m facing is when I apply more than 1 filter, the search results show users containing one of the filters (e.g. filters = female, $40K - $60K, full-time job will show all females, all users earning 40-60K, and all full-time employees)
I think here what you need is AND filter instead of OR. Try with the AND.
And can I know why you store all the values on a text property called search index? You can store that values with different properties. Also for the last filter? You can add the Logged in user > property to the filter.
I got help from an Adalo expert who advised that using a search index and last filter would be best.
The search index is suppose to be used to filter with any of the options, for example the logged-in user could fill out every dropdown or just 3 different ones and still end up with a result of users that contain the chosen filters because they are combined in their individual search index. Once the logged-in user clicks “apply” after choosing filters, it creates the last filter. The results list then filters by every user’s search index according to the last filter, so if a user has one of the chosen filters in their search index they would show up in the list, but this isn’t working well because I need users that contain all the chosen filters.
If you think there’s a better way to implement this idea I’d love to hear it!
The options are stored in the the search index property for each user and when the user clicks the button the chooses options from drop-downs are saved right?
I think you don’t need a property called last filter because you don’t need to save the results from drop downs and you can use the drop downs values in any screens to filter!
You can remove that last filter,filter and add the other filters as OR and try again ( you can use AND too to see the results that you get ).
I forgot to mention the reason I have the last filter property. I want to be able to save the dropdown options the logged-in user chose and save the list of users that come up as results once filters are applied. However, when I click on a user’s profile which links to their information page and then return back to the filtered list, the results disappear and all the users in the database are shown. Any idea on how to fix this?