Filtering yes/no, empty records and below $5

Hey guys,

I think I have a very simple question that I cannot figure out the solution and hope someone in the forum can help.

I have a repeating group displaying data from the Products data type, and I want to create a dropdown that filters the products on the repeating group that the availability = No, empty images and price < 5.

Does anyone know how to do that?

Thanks,
Bruno

Have you had any luck with the :filter operator?

Thanks, @jared.gibb

I couldn’t make the :filter operator worked on this use case because I want to click in a group element filtered in the repeating group but for some reason is not working.

I tried to create a custom state to do a search for products with availability = no but bubble doesn’t accept.

Create an options set called “availability” with their names being “no”, “empty images”, “price < 5”

Create a field in the product object called “availability” and set it to the option set “availability”

Set the dropdown’s choice style to “dynamic”, the type of choices to the option sets “availability”,
the choices source to “All availability”, and the option caption to “current option display”.

Hope this helps :+1:

Thanks @cmarchan!

The set up suggested, it’s necessary to update the database records for the new object called “availability”. Do you know if I can do automatically?

For example, all the products with availability = no, it’ll be set as “no” in the new object availability.

Bruno

Use backend workflows to make changes to your dB

@cmarchan and @jared.gibb I also tried to set a custom state to filter products with availability = NO but for some reason, it doesn’t work. Check the video below.

https://share.vidyard.com/watch/7UEP4NUwceuVCoEreg528F?

The custom state is of type “product” … so it is expecting a “product”. You are trying to give it a “y/n” value … or an options set with a “no” display. It simply does not work because you have to give it what it expects.

Now … to filter your rg for products with a “y/n” value of “no” … set up your search constraint like this > “availability” = rg’s custom state’s product’s availability is no (or … the option set “no”). This assumes that the availability field is of type “y/n” or of type options set with one of its option being “no”.

Hope this helps :+1:

1 Like

Thanks again Carlos!

I have a feeling that I’m close of the solution but still not working. Check it out the new video that I did.

https://share.vidyard.com/watch/UizEF8nTK1ejH3BxH7CKAF?

Hello Bruno,

Your thought process is incorrect. A repeating group element is searching and filtering for a list of entries of an object’s fields/attributes. It is assessing row by row each object entry against constraints and advanced rules. That is it.

I do not know how you structured your dB but let’s assume that a product has a field called “availability” of type “options set” also named “availability”. And let’s assume that this options set has three options > #1 “no”, #2 “empty images”, and #3 “price < 5”.

Then … the search would be … search products where the constraint would be availability = custom state of type options set “no” … or however else you can provide this options set option to this constraint.

I see that you are doing lots of filtering and likely are managing for some things to work and for some others not. You should take a second look at your dB model and also watch a few videos on searching/filtering lists. Lists can be of any kind … but they are lists at the end of the day … and they are managed differently than single entitites (… think … singular vs plural).

Here a few good resources:

Hope this helps. Best of luck with your app! :+1:

Thanks so much @cmarchan!

I think it’s not possible filtering the repeating group by some constrains, because my availability data field is type yes/no and I need to create a new data field and set as an option set to make it work.

However, I found a workaround that is not perfect but does the job using multiple repeating groups and adding different constrains in each one.

Also, I watched the videos that you send and was amazing :slight_smile:

2 Likes

I’m doing slightly the same thing, but I just change the datasource of the RG with conditionnals.
Though I’m wondering what is the best practice for such things

Hey @emile.elie

In the end, I changed the way to filter repeating groups creating custom dropdowns and it’s working well. Check it out this video: Custom Dropdowns | Bubble.io Tutorial - YouTube

Bruno

1 Like

thanks, this is a nice trick

1 Like