When Using New field type text, when should i use the list function and when should i not use it

When creating a new field , a name for the field is required and also a type. Type can vary to any data types you currently have, but also the option to add lists is below. I don’t understand the use of list and how it works with different data fields and or different data types.

What Bubble calls a “list” is the same as what’s called an “array” in other programming languages. It’s just a way to store multiple things of the same type.

Bubble calls it a “list” because, well, that’s an easy way to think about what you might use such a structure for. Clicking the list checkbox makes your field a list of items, rather than just a single item.

Do you need to store multiple things of the same type? That’s when you’d use a list.

Suppose you are building some sort of dating site. Suppose you want your users to be able to describe activities or hobbies or sexual practices that they are interested in. Do you think your users would have more than 1 activity or hobby or sexual practice that they are interested in? (I hear you saying “yes”.) I agree! Use a list! Your User object might then have a list of Favorite Activities on it, a list of Hobbies on it, a list of – well, I’ll stop there.

Suppose you are building some sort of book-related site. Suppose you want to store – wait for it – LISTS of the Top X Whatever Books of All Time, like “Top 10 Science Fiction Novels of All Time”, “Top 30 Autobiographies that will Make You Hate their Authors”, “Best Summer Reads of 2019”… Those would all be lists… lists of Books.

Suppose you are building some sort of travel, booking or reservation site. You’re going to have many many lists of things in your database. I’m sure you can imagine some of them.

LISTS are ubiquitous in Bubble (just because you’re almost always going to have more than 1 thing of any given type).

Above, I gave some examples of explicit lists. Like, you know that you need to create a field that is a list to hold these multiple things. And so – for example – you create a field called “Favorite Books” on your User type. That field is of data type Book and you click the “list” checkbox. So now you can store a list of Books on the User that represent their favorite books. A “Friends” list can be a very similar thing. In that case, you might have a field called Friends on the User. That field would be of type User and, again, it would be a list so you check the box. Now your Users can have a list of Friends (who are, naturally, other Users of your app).

But there are also implicit lists. Here’s what I mean by that: Your app (whatever it is) will come to have at least a few custom data types in it. In fact, every Bubble app has at least one of these – the User data type. Your app will of course have more than 1 User at some point. (Hooray!) And if your app is about books it will have more than 1 Book right?

Now imagine all of the Users in your database. That’s a list. A list of all the Users who have signed up. Imagine all of the Books in your database. That’s a list. A list of all the Books that are in your database.

Now, imagine all of the Books in your database that are terribly boring biographies. We can use a Search expression to find those. (We might “Do a Search for… Books… with criteria Genre = Biography and Bore Score > 10”. This will return to us a list of terribly boring biographies. That data object is a LIST of type Book.)

So you will soon become very comfortable with lists, even if they perplex you just now.

Have you done the tutorial lessons yet?

1 Like

Yes Thank You , i just didnt understand how to acess the items in the list because when chosing list certaing functions become available and the farther from the user the less items one may be able to reach. But i got it now! with some practice and good teachers life is easy.