How do I filter a list?

This is probably super simple, but I can’t figure it out.

I want to show a list of INGREDIENTS, but filtered so it only shows a specific INGREDIENT TYPE.

I have these 2 types in my database: INGREDIENTS and INGREDIENT TYPES.

My INGREDIENTS type has a field using INGREDIENT TYPES.

So when I create a repeating group, I can make the type of content be INGREDIENTS. From there, I have no idea how to filter it to only show ingredients that have a specific INGREDIENT TYPE.

I want this filter to be pre set (the user can’t change it).

How do I do this?

Welcome to Bubble and the forum. This is the key to a lot of the stuff you will be doing in Bubble. Have you followed the lessons already? That’s a great resource to get you started. The videos are also informative (even if they are a bit old :slight_smile: )

I have gone through the lessons and watched the videos, but I still can’t figure it out.

I’ve set up my repeating group. Type of content is INGREDIENTS.

Data source as I understand it should be Do a Search for INGREDIENTS. Then I add a constraint to show only one INGREDIENT TYPE.

But I can’t figure out the constraint.

I’ve tried INGREDIENT TYPE =

But I’m stuck there. It should be INGREDIENT TYPE = Protein (one of my ingredient types).

But I can’t type it in as it won’t work that way. And I can’t select a specific ingredient type from the dropdown. None of the other options seem to work either.

I’ve tried making the parent elements type Protein, but I can’t figure that out either. Seems like I could make it work with a dropdown, but I DON’T want to do that. I want this list to specifically be a list of ingredients of a certain ingredient type without any input.

I’ve been stuck on this for almost 2 days and i’m not able to make progress.

Hi @jasondupree

I’m not sure since I cannot see your editor.
But, Have you tried this?

I’ve uploaded a video walking through exactly what I am doing and what I’m trying to do.

Link: https://youtu.be/2ImZb01DOo0

Excellent, I think I can help you.

  • at 2:22: you don’t need the quotes around protein.
  • after that, it will be red, just select first item. This search will return a list and that field needs to be a protein item.

If, after that, you still can’t see any results, you might be bumping into privacy rules. The debugger will normally highlight this to you.

OK, so I’ve removed the quotes and selected ‘first item’ and it works. I’m just not sure I understand why it works or what first item does. I’m also not sure what you mean by “This search will return a list and that field needs to be a protein item.”

Thanks for the help, I can finally continue work on this!

Without the first item that search result is returned as a list. Even if that list has only 1 item inside of it. With the first item that becomes a single item.

So that search constraint Ingredient type = requires a single item.

If you set to Ingredient type IS IN it will accept a list. Meaning, you don’t need the first item.

1 Like