I am wondering if it is possible to create an “advanced” or structured search for Bubble. I am thinking of the advance search feature in a CRM like Microsoft Dynamics, where you can essentially search for a list of people who have certain features, and certain relationships to other tables. So for instance if I have a table called “People” and a related table called “Passports”, a query might be: “Find all people who are male, aged over 16 and have a UK passport.”
I know I can build this when I setup the repeated group, but I want the user of the CRM to be able to select all the criteria themselves.
I would recommend having either a custom state as a list of things or use a karma ware plugin called list shifter to hold onto the list. My personal preference is to use listshifter.
You can then on the repeating group have the list (either from custom state or list shifter) as the datasource and then have the ‘filtered’ operator in the dynamic expression where you set your constraints to the filters selected by user.
Benefits are you don’t need to do a large number of workflows (not just too cumbersome but also does require computing power to perform those actions). Also, still get benefit of quick changes as the datasource is already loaded, so changes to the filters selected will be quick.
As much as possible as a general rule for optimizing an applications performance is less is better. Less searches, less workflows, less elements. Additionally, you want to avoid as much as you can using searches in a workflow action and instead feed your data values to your workflows from a source, likely on the page.
BTW make sure you use the checkbox to ‘ignore empty constraints’ on your filter operator.
@unsub I’m trying to duplicate Andrew’s ‘daisy chain filtering’ at the moment. In addition to the video Rico posted, this is a followup video Andrew posted describing his set up.
Hey, this worked great. I have my search function working well. I have also figured out that you can save a specific configuration of search filters by writing a parameter to the querystring for each filter.
I am struggling though with how to take a multiselect dropdown, write the selected items to the querystring, and then use them to populate a custom state on the page. Getting the values into the querystring is easy, but when I try to write that list to the custom state, it fails if there is more than one value. Any clues how to do this?
Hi @rico.trevisan and @Andrew.Vernon – what’s the advantage of this “chained” search methodology as shown in the video, vs. just throwing all those constraints in a single “search for” box and checking “ignore empty constraints” so that it’s only searching based on selected constraints?
First, there are times where you need to filter using other data types, or you’re using an advanced filter (which is incompatible with Bubble’s ignore empty constraints checkbox)
There are also times, similar to my setup where you might have a different interface (like my checkboxes) for deciding when a filter should be applied or not.
Since not everything can be handled through ‘ignore empty constraints’ and using conditionals to change a data source can get messy quickly, this approach allows you to handle all your filters in a logical and organized way with all filters being listed in the same place.
Thank you for the context. On my end I try to keep everything in the “search for” box because: a) it’s easy to set up; b) minimizes the number of workflows; and c) in most cases it keeps the search server-side (which is my goal because it’s scalable) vs. the risk of bringing data client side for processing.
I’ve encountered some of the issues you mention, but have pursued different workarounds:
To replicate “ignore empty constraints” functionality with an advanced filter, I put an “or” statement at the front of the advanced filter statement to check if the constraint is empty.
In situations where an input’s value needs some manipulation before it can fit into a constraint and work the way I need it to, I use a workflow to do that manipulation and save the value I need into a custom state, and the search constraint refers to that custom state.
As a side note on advanced filters, I try to avoid them given their client-side processing, but sometimes there’s a core need for a certain type of search and that’s my only option. I’ve taken the performance tradeoff in order to gain the functionality, but know that I’m just kicking the problem down the road since the performance issues will only get worse as the database grows.