Operations on a list

Himanshu Sharma
3 min readSep 19, 2021

Lists are common in a Bubble app. They are frequently used to store information in Bubble’s database or in custom states.

Lists can be a list of things, numbers, users, text, Option sets. And if you are using lists in your app, you’d want to manipulate the data as well.

I’ve created a custom state called list_1 which will be used for adding and removing a single item from the list at a time.

Adding to a list of state vs adding to a single state

The value that you need to define in the case of lists, has a defined structure. It is slight different that simply putting it as Current cells firstName, which you’d do if the custom state was not a list.

If it is a single state, the operation that you’ll adopt is

While for a list of state, the value will be value of the list +/- value of the current cell.

Adding a single item to a list

To add a single item to an empty or a non-empty list, the workflow remains the same. We need to use :plus item to add that entry.

As we need to add a single cell entry, the Add button, which will be the trigger, has to be in every cell. Unless we add it to the cell of the repeating group, we would not be able to refer the cell entry in the workflow.

The value will be value of the list+value of the current cell. In our case, it will be value of list:plus item Current cell’s firstName.

Removing a single item from a list

Removing a single item from an empty or a non-empty list is similar to the one for adding an item. The only difference, instead of :plus item, we’ll use :minus item.

Again we’ll need the workflow trigger (button/icon) in each cell of the repeating group in order to reference the value in the workflow.

The value will be value of the list-value of the current cell. In our case, it will be value of list:minus item Current cell’s firstName.

Editor — https://bubble.io/page?type=page&name=list_operations&id=nocodeassistant-tutorials&tab=tabs-1

Preview — https://nocodeassistant-tutorials.bubbleapps.io/version-test/list_operations

If you need some help with your Bubble app or if you need a team of Bubble developers to build a Bubble app for you, reach out to me at himanshu@nocodeassistant.com. You can also follow me on Twitter.