Three Ways to Add Data to Repeating Groups in Bubble
Here's three ways to add data to your repeating groups in Bubble and if you find this video useful we'd really appreciate a like and subscribe. You can also find many more Bubble tutorial videos exclusive to our members at PlanetNoCode.com.
Method 1: Direct Data Source
Way number one is probably the most straightforward. On your repeating group, select the type of content you want to display and then get your data through one of two ways: either do a search for (in this case I'm doing a search for contacts) or refer to a list field in your database. This is going to pull in all of the contacts from my contact data type and display it on the repeating group, and you can see it's doing so there.
Method 2: Using Workflows
Route number two is that you can use a workflow. This is particularly useful if you need to update the content in the repeating group. For example, the data source methods can be useful for what you want to display initially when the page loads, but what if I want to update it? Let's change this to update data and add in a workflow. I'm just going to delete these; these are from a different demo about pagination on tables, so go check that video if it's already live.
Let's put data in through a workflow. We can use element actions and we can say display list. I've only got one place on the page I can display a list, and that's my repeating group. As long as my data source results in contacts, I can override it. For example, if I say do a search for contact, I could use this as some sort of filter. I could say where first name is Jessica and go back into my workflow. I could say where first name equals Jessica.
So that's only going to return contacts where the first name is equal to Jessica. If I refresh the page, my default loads in all of my contacts, and then if I say update data, I'm only going to get Jessica back.
Method 3: Using Conditional Statements
Route 3 is that you can use conditional statements. On my repeating group, I can use this button here to set a custom state. I'm going to create a custom state on my page here. Custom state is a way of temporarily storing data; it isn't saved to your database and it's lost when the page refreshes.
I could just say filter and then I can say if that's a yes or a no, by default to no. But if I click this button, I can set state my page that filter to yes. Then in the condition, I can say when the filter (remember this is my page; I've called it my page repeating group just to be a little bit confusing) is yes, I can change my data source.
This time I could say do a search for contact. Let's try to find something else relevant. Let's say where contacts first name contains "hey". I'm not quite sure what that's going to do, let's have a look. My full list loads in and then set custom state, and yeah, I just get the words that contain "hey".
Conclusion
So there you go, that's three different ways that you can add data to a repeating group, allowing you to be really quite flexible with how you're developing your MVP with Bubble.