Operations on a list

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.

--

--

--

I help people bring their ideas to life with Bubble. http://nocodeassistant.com/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

FLASK… endpoints-2

JavaScript Series: Everything You Need To Know About JavaScript Conditionals

Middleware Explained

QR Codes generation with React

Powerful search and replace across files

example search and replace by capture groups

Common Problems Caused by NPM Package Management

2NF Fully Explained

Amazon Prime Now Checker

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Himanshu Sharma

Himanshu Sharma

I help people bring their ideas to life with Bubble. http://nocodeassistant.com/

More from Medium

Admin privileges and access

A Sneak Peek at Joget DX 8: Focus on User Experience and Governance

How to create an app without writing a single line of code

No Code: From brainstorming to implementing a website in one day.

Lo-Fidelity Wireframe on paper for the SurfSpotr-Website.