Ask a question
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. And also you can find many more Bubble tutorial videos exclusive to our members at planetnodecode.com.
Data Source & Do a Search for
So way number one is probably the most straightforward, which is to, 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 and doing a search for contacts, or you refer to a list field in your database. And so 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. Route number two is that you can use a workflow, and 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 do you want to display initially when the page loads. But what if I want to update it? For example, let's change this to update data, and let's add in a workflow. I'm just going to delete these. These are from a different demo. That's from a demo about pagination on tables. So go and check that. is already live. But yeah, let's put data in through a workflow. So we can use element actions and we can say display list. And then I've only got one place on the page I can display a list and that's my repeating group.
Overriding Data Source with a workflow
And so as long as my data source results in contacts, I can override it. For example, if I say do a search for contact and I could use this as some sort of filter. For example, I could say where first name is Jessica and go back into my workflow and so I could say where first name equals then I'll right click on that to remove it click in there Jessica. So that's only going to return contacts where the first name is equal to Jessica. So 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. So that's route two. Route three is that you can use conditional statements. So on my repeating group, I can say that, for example, when currentUser... No, that's not a good example, let me think. Let's have a custom state. So I could say, use this button here, I could use this to set a custom state. I'm going to create a custom state on my page here. Oh, this is again from a previous demo about pages.
Conditional statement and Custom State
So custom state is a way of temporarily storing data. It isn't saved to your database and it's lost if the page refreshes. So I could just say filter, and then I can say say if that's a yes or a no, by default a no. But if I click this button, I can set myPage, that filter to yes. And then in the condition, I can say, when the... Remember, this is myPage, I've called the myPage repeating group just to be a little bit confusing. It's I can change my data source. And so this time I could say do a search for contact. Let's try find something else relevant. Contact contains A. Let's just see what it does if I do that. Where contacts first name contains A. I'm honestly not quite sure what that's going to do. Let's have a look. So my full list loads in and then set custom state and yeah I just get the words that contain A. 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.