Filtering a repeating group using a location state

Hi everyone,

I am trying to filter a repeating group using a location state and I’m getting some unexpected behaviour.
This seems to work ok until I try to filter using one of the other states on the repeating group.

This is what I have set up, which has been working fine:

I have a repeating group which shows users listings.
This repeating group has a category state, which users can then select from a side menu, where the categories can be added or removed from the category state:

I have the group filtered per below:

The RG will show all listings until a category is clicked, should the user wish to narrow down the search. This all works perfectly.

Now, I have added an additional location state to this repeating group, which contains the value of a filter search box.

The way I have set this up is:
When a user chooses a location, and enters search, this creates a new data type: ‘search listing’

I have then set up a workflow for a separate filter bar (filter bar listing) to display the location of this state (this works fine, as I can see the location being displayed)

And also to set the state of the repeating group to the value of this location state:

For some reason, the above workflow to set the location state does not seem to be working unless I actually trigger the category state workflow.

So, when the user searches the listings, my repeating group will show all listings, however when I click on a category, it seems to work ok i.e. that it correctly only shows listings in that location.

When I remove the category states / workflows, the location state seems to work fine but they don’t like to work together for some reason…

What I want to happen is; when a user searches using a location, the RG will only display listings in this location (and have the option to select a category once all available listings in this location are displayed). At the moment, it seems that this location state only works when the category state is triggered…

When I use the debugger, I know that there is no issue with the location state, I just cant understand why my RG wont display these listings only.

Hoping someone can help point out what I’m doing wrong. I’ve tried so many different conditionals / filter searches that I can bear to think at this stage.

You can set a conditional on your repeating group to change the datasource.

Maybe set up a conditional for when the location state is not empty to change the datasource so that you search for the listings, constrained with the location and after that in your dynamic expression set up the filters for the categories. Make sure that ‘ignore empty constraints’ is checked so that if the user deselects categories but keeps the location the search will show all results for that location and ignore the empty category constraints.

Thanks @boston85719 for getting back to me. I actually came across your other posts re filtering and they really helped me get to where I am now :slight_smile:

So, I have changed my conditional to change the data source to search for user listings when the location state is not empty, like so:

This now works and only shows listings within the location state, however my category state doesn’t work as you mention I need to set up filters for the categories. Not sure what you mean here, are you saying I need to change one of my filters (below) and add a new constraint?

Thanks again for your help

I"m not sure if this is what you are referring to when I set the filter on the conditional search but I can’t seem to find any expression that allows my listing categories to intersect with the category state of categories selected in the category state:

No, this can be confusing if not aware of the options to add ‘more’ to your dynamic expressions.

Basically, your first portion of the dynamic expression of ‘do search for user listings’ with a constraint on the location is, after setting the constraint going to turn blue and signal it is a working expression and completed…however, you can click on it again to make it orange and see a button called ‘more’

Screen Shot 2020-12-17 at 1.15.29 PM

Clicking on more will open a dropdown of other things you can do to the search, such as filter or limit the number of items returned etc…

You want to choose filter and then in that new filter dialogue that opens add the constraints for the categories

The feature of ‘more’ allows you to do a lot of stuff, one notably is to merge two searches or more together and subsequently sort and filter all the results. Play around with it and get familiar with the options and what they do, it will open up a lot of control over how you present information through a repeating group.

Hi @rachelwalsh365! Could you point me out to @boston85719 's article you mention?
I am new to building on Bubble, I need to create a repeating group based on location (markers on a LeafyMap) and I don’t know where to start. Maybe that article can point me as well in the right direction.

Thanks in advance!
Francesco