Hey Bubble community!
I am currently trying to add a secondary filter onto my search results page. Currently, I have the two filter groups as “merged” which seems to work as an “OR” function which means that the primary search function is overridden which is not what I want.
I am hoping to be able to apply the primary search, which is done on the homepage and the search results shown on another page. And after the page loads with the results be able to apply a secondary search filter which will further narrow the results.
Any advice is very much appreciated!
I’m guessing you’are using a RG to display results on the search results page, from the search criteria on the home page.
Have you tried storing all search criterias and filter values in Current User, then changing the data source in the RG depending on those values combinations?
Feel free to include screenshots to make it easier for us to understand as well
Hey @ambroisedlg , thanks for your response!
So, I have my data types defined as below:
(1) artist - this is the list of artists that is stored and displayed in a repeating group on the search page. This is what I have as the current data source for the search page
(2) booking - this is where the input data is stored from the users. I was hoping to be able to use this as a data source but was never able to figure out how to make that work since the repeating group displays data from the artist data type.
(3) user - collects all of the booking data that the user conducts overtime.
Currently, I send the input data from the homepage into the URL so the values can be extracted from there and used as filters on the search page. I have added screenshots of the homepage, the search page and the data source for the search page to provide more context as well.
Let me know if I can add any other information
Tell me if I’m wrong but from my understanding you’re only trying to filter Artists depending on the user’s choices, on both the home and search page right?
In which case filtering with the input’s value or another data type should give the same results. Although I’m not too sure why you want to store the input values in the data type Booking ? You can just:
- store the search values in Current User
- filter your RG by doing a Search for Artists with constraints from Current User’s data
- create the Booking with those data when User actually confirms the booking (by clicking on the “Book” button)
Plus with the method above, you don’t lose the search values in case the user leaves the page then comes back to the search page.
Anyways I drafted a quick demo, hope it helps: https://searchdemo.bubbleapps.io/version-test
Here is the editor: https://bubble.io/page?type=page&name=index&id=searchdemo&tab=tabs-1
As you can see:
- I created a dummy Artist in NY with Technique1, Type1, and Styles (list of texts) set as Option1 and Option2.
- I then set the data type User with according fields, SearchLocation, SearchTechnique and SearchFilters (which is a list of texts as well).
- When user clicks Update Filters, it sets SearchFilters to the list of choices from the dropdowns. See the condition on the RG to filter the data source when Current User’s SearchFilters count > 0 (meaning the user wants to use filters). I’m sure you can do some kind of auto-binding on the filters instead of clicking on the Update Filters button, but you get the idea.
Let me know if that’s working for you
Btw if you really want to use the data type Booking, just create a Booking and store those values in Booking when User clicks the Search button on your homepage, then pass that data to the search page (which should be of type Booking). On the RG on your Search page, just replace the Current User’s data fields by the Booking’s ones.
WOW @ambroisedlg thank you so much!! I can’t tell you how much that demo helped me! I honestly don’t think I would have understood the solution without it. I changed the fields to follow the Current Users selections and that has worked! For the secondary filters, I created a dropdown value change workflow for each dropdown that filters the data by the secondary dropdown selection and the first criteria selection so no button needed. Thank you so much again!!
Awesome! You’re very welcome, glad to be of help
Hey, @ambroisedlg there’s a chance to make the link to the search demo live again?
Tks in advance