Filtering a repeating group based on post content

Hi,

I have users who can create 1 post containing multiple data such as images, and locations attached to those image. I am having issues trying to figure out how posts can be filtered based on posts containing a location within the dropdown. I have generated a repeating group which displays 1 random photo from a post, and when that photo is clicked, a pop appears showing the rest of the data for the user. However I am struggling to get the dropdown filter to work. I need the repeating group to display only posts containing the dropdown value. As seen in the example images, there are posts which include photos in USA, however when this option is picked in the dropdown, posts inlcuding photos in USA do not display?

I would appreciate any sort of help on this.

Thanks





Unfortunately still having issues with this. I have attached more screenshots of the options I get, and I keep trying various scenarios with no success.



Hi @alendedja79,

  1. Have you tried making the dropdown value USA instead of United States?

  2. Have you added Google API key/s to your settings?
    Here’s a link for how to set everything up: https://manual.bubble.io/help-guides/working-with-data/working-with-location-data

Bildschirmfoto 2022-04-07 um 12.33.40

Let me know if this helps.

The wording of the values is not the issue, as I have tried other countries and still doesn’t work.

Regarding the google api, this is all set up, but the inputs and outputs are basic bubble geogrpahic addresses to keep it simple at the moment.

Sure since displaying addresses also works for you.

Even if this would work, I would recommend to save the Country as a text separately in a field on your Post data type.

This way you can use it inside a search and searching for posts becomes more efficient instead of using a filter (Adv. Filter can be painfully slow once you have a few posts).

Let me know if that works for you.

@jukoen you would recommend changing the initial content format to ‘text’ ?

If this is the case, I wouldn’t want the data to get all messy in terms of wrong spellings, and just random text being input? I would rather this be in address format to make this type of data in one correct format type.

Oh no please store the address as you are doing currently.

I am just saying that in an additional field you can store the country as text (via the :extract country method).

Post
– location (geographic address)
– country (text)
– …
– other fields

This way you can make your search more efficient and solve the issue you were stating in your original post.

Is this clearer now for you? @alendedja79

@jukoen I have managed to extract the country as text in a new data field. However, when trying out options for filtering the repeating group, it doesn’t give options directly to enable ‘dropdown value = country’ for example. The country is located within the ‘post content’ section, which then requires further data sources, instead of doing an ‘=’ to dropdown value.



Why do you have the “1. Post” and “2. Post” as separate data types?

If there is no reason to do that you should simply go with this model unifying both:

Then do the following.
Actually super simple to get this done in Bubble. :slight_smile:

The aim is create 1 post with multiple data, such as images, and locations attached to each image. This is the way I have been able to build it, by having 2 different data types, but linked with each other.


With this, I wasn’t ever able to add multiple data to create 1 post. Unless I did it wrong initially?

Post 1 is a Trip
Post 2 is a Post like I described it

If you want to show the Trips that have Posts from a certain country in it, then simply save the countries as a list of texts on the Trip data type.

Then in your RG search you can access the Trips where countries contains ‘Dropdown’s value’.

Unfortuantely, the way you have built it originally will start to get pretty slow as soon as you have a few Trips listed. I understand that as a beginner it is not that straight forward to build these searches in Bubble but I think you should be able to get it done now.

Let me know if this works for you @alendedja79 .

@jukoen Would you suggest actually restarting, and putting everything in 1 data type?

Would be good to get your input on how you would go about doing this?

The premise is for users to create a post with multiple images and locations. Then users to be able to filter posts based on different data content such as country etc.

@alendedja79 I think you are very close to achieving what you want!

I think it makes sense to rename your tables like this:

Then have Trip hold the countries as a list of texts in a new field to filter on that in a search.
Any additional field you’d like to filter on should also be on the Trip datatype ideally.

I am saying ideally as having nested filters of course works as well, but is going to slow down your app immensily once you have say 10 Trips with a few 100 Posts.

So leave everything as is just make sure you have the fields you want to use in your search/filtering logic on the Trip data type.

To this:

I think it makes sense to have separate datatypes for Trips vs Posts:

  1. It is a different thing
  2. It reduces the search space down to just the number of Trips & not number of Trips + Posts
  3. If 1. changes you could later change this

Did you get this to work?

So you mean something like this:

Then use the filter based on that data source?

You’d have to add this “countries” field on the Trip data type and make it a list of texts not just a single text.

Each time a Post inside this Trip data type changes update the countries (list of texts).

You can then use the search like this (not filter):

Is this clearer @alendedja79 ?

This topic was automatically closed after 70 days. New replies are no longer allowed.