# Filtering a repeating group using a location state

**URL:** <https://forum.bubble.io/t/filtering-a-repeating-group-using-a-location-state/126123>\
**Category:** App Organization\
**Created:** [December 16, 2020, 6:57pm UTC](https://forum.bubble.io/t/filtering-a-repeating-group-using-a-location-state/126123 "2020-12-16T18:57:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rachelwalsh365](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@rachelwalsh365](https://forum.bubble.io/u/rachelwalsh365)\
**Post date:** [December 16, 2020, 6:57pm UTC](https://forum.bubble.io/t/filtering-a-repeating-group-using-a-location-state/126123/1 "2020-12-16T18:57:25Z")

</div>

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:

 ![Screenshot 2020-12-16 at 14.26.04](https://us1.discourse-cdn.com/bubble/original/3X/3/e/3e380231196d103851d7efe65b22d89fef5f058b.png)

I have the group filtered per below:

 ![Screenshot 2020-12-16 at 14.46.08](https://us1.discourse-cdn.com/bubble/original/3X/f/e/fe506aa9774bb60dc9f2515bf6c06a7e441442d3.png)

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’

 ![Screenshot 2020-12-16 at 14.55.59](https://us1.discourse-cdn.com/bubble/original/3X/d/4/d4432234f6c991b78d6b36a4bade0d274140f6f2.png)

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)

 ![Screenshot 2020-12-16 at 14.57.52](https://us1.discourse-cdn.com/bubble/original/3X/6/2/62967ba498328c8ceac52d6fea5037999ecbc506.png)

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

 ![Screenshot 2020-12-16 at 14.58.52](https://us1.discourse-cdn.com/bubble/original/3X/b/7/b788c274e6d681bd8c95e69cd182e3630a19c0ec.png)

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.

---

<div class="post-metadata">

**Author:** ![boston85719](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/boston85719/32/77286_2.png) [@boston85719](https://forum.bubble.io/u/boston85719)\
**Post date:** [December 16, 2020, 7:10pm UTC](https://forum.bubble.io/t/filtering-a-repeating-group-using-a-location-state/126123/2 "2020-12-16T19:10:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rachelwalsh365](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@rachelwalsh365](https://forum.bubble.io/u/rachelwalsh365)\
**Post date:** [December 16, 2020, 7:40pm UTC](https://forum.bubble.io/t/filtering-a-repeating-group-using-a-location-state/126123/3 "2020-12-16T19:40:05Z")

</div>

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 🙂

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:

 ![Screenshot 2020-12-16 at 19.31.26](https://us1.discourse-cdn.com/bubble/original/3X/6/c/6c2c29a88f7afaf034f1606b0094baa654532da7.png)

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?

 ![Screenshot 2020-12-16 at 19.38.21](https://us1.discourse-cdn.com/bubble/original/3X/7/c/7c7a1b0aa8d758ba516d191f89d464c39ec9cc75.png)

Thanks again for your help

---

<div class="post-metadata">

**Author:** ![rachelwalsh365](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@rachelwalsh365](https://forum.bubble.io/u/rachelwalsh365)\
**Post date:** [December 16, 2020, 8:40pm UTC](https://forum.bubble.io/t/filtering-a-repeating-group-using-a-location-state/126123/4 "2020-12-16T20:40:02Z")

</div>

> [@boston85719](#):
>
> after that in your dynamic expression set up the filters for the categories

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:

 ![Screenshot 2020-12-16 at 20.37.20](https://us1.discourse-cdn.com/bubble/original/3X/c/d/cd040aacb027e9d989d70bcad703954822885568.png)

---

<div class="post-metadata">

**Author:** ![boston85719](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/boston85719/32/77286_2.png) [@boston85719](https://forum.bubble.io/u/boston85719)\
**Post date:** [December 17, 2020, 6:21am UTC](https://forum.bubble.io/t/filtering-a-repeating-group-using-a-location-state/126123/5 "2020-12-17T06:21:29Z")

</div>

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](https://us1.discourse-cdn.com/bubble/original/3X/e/c/ec851b5fb5d57187c9b32b469baa7d934eb86c2e.png)

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…

 ![Screen Shot 2020-12-17 at 1.18.52 PM](https://us1.discourse-cdn.com/bubble/original/3X/3/c/3cad1f8b0b41761be413db5a79996addf5a91c4d.png)

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

 ![Screen Shot 2020-12-17 at 1.20.04 PM](https://us1.discourse-cdn.com/bubble/original/3X/6/6/669a687d701b408874b3b96b6f5d1c28e340c330.png)

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.

---

<div class="post-metadata">

**Author:** ![fellowdroner](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fellowdroner/32/111707_2.png) [@fellowdroner](https://forum.bubble.io/u/fellowdroner)\
**Post date:** [October 29, 2021, 12:30pm UTC](https://forum.bubble.io/t/filtering-a-repeating-group-using-a-location-state/126123/6 "2021-10-29T12:30:23Z")

</div>

> [@rachelwalsh365](#):
>
> @boston85719

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
