Data Handling with Bubble
Data Handling with Bubble
Creating and managing an app you developed yourself also means creating and managing the data that your users input. The ability to gather & control these user-generated data and use these to customize a personalized user-experience with your app is what makes it more than just a glorified applet or browser.
As daunting as it may sound to have to deal with the possibly sensitive data of what could potentially be thousands upon thousands of loyal users, Bubble makes the task of maintaining and managing a database exceptionally easy.
In this tutorial, we will be teaching you how to set up Bubble apps and databases. This will include creating data types or ‘things’ in your database, collecting inputted user info in the form of those things, and modifying those things once they have been created. This tutorial assumes you already know how to authenticate users, though we’ll also discuss it briefly at the start to bring you up to speed.
All that and more will be shown in this guide for No-Code Web Development Support.
Managing and Authenticating Users
The ‘Users’ data type in your database serves as your app users’ identities and accounts on your app. This data is necessary to allow you to link your users to the data they give your app as input or through their regular use.
Every time a user opens your app without having logged in, their data is saved as a temporary session. If they don’t clear their browser’s data, their activities will be saved to their temporary account. It should be noted that Bubble automatically clears temporary data from databases every three days, so you should not rely on temporary user mechanisms as a long-term solution.
Creating a user is as simple as setting up a visual element with a workflow using the action ‘Sign the user up’ or ‘Create an account for someone else’.
A ‘Sign the user up’ workflow action will accept an email and password input from the user. Then, it will create a new data item of the ‘User’ type, verify the uniqueness of the email, and save it to the database. It should be noted that your app’s users must have a unique email address.
Once your users already have their accounts, you will need to create a login workflow to allow your users to log back into their user accounts if they ever log out.
Aside from your custom workflows, you can also make use of plugins like OAuth to allow your users to sign up and log in through their other social accounts.
The Data Tab
The heart of your app’s backend is the Data Tab. This is the third tab down on the left-hand toolbar of the Bubble Editor. From this menu, you can manage data types, fields, data privacy, and even individual database entries.
Data Types
Before you can work with data in your database, you’re going to need to define data types. We already mentioned them earlier when discussing user authentication, but just to be clear, a data type represents a kind of classification for your data. It tells your database what form your data is going to take and what structure it’s going to have.
You can manage data types from the Data Types submenu of the Data Tab. From the menu, you can create a new data type using the button on the left-hand side of the screen.
After you’ve created and named your data type, you can define and modify its corresponding “fields” on the right side of the screen. You’ll need to give each field a name by which it will be referenced and a type such as text, number, or date. You can also make each field accept a list of data entries of a certain type.
Take note that the menu also allows you to modify other existing data types.
Creating and modifying “things”
In Bubble, a “thing” refers to a data object. A single instance of data structured by one of your defined types is a ‘thing’, for example. Creating “things” means creating new data and saving it to your database.
This is done by simply using a workflow. After creating a workflow, add the “Create a new thing” action. This action allows you to select a data type that the thing you’re going to create will fall into. At the bottom of the data type drop-down is also an option to create a new data type like the above, in case you need to make a new type on the fly.
Once you’ve picked a data type, you can add the values that you’ll assign to some or all of the fields.
Similarly, the Modify a Thing workflow also allows you to choose a thing from your database and modify it. You’ll need to define a filter to find the thing, but once you’ve selected it, you can simply modify its fields. Take note that there’s no need to select a data type because it’ll already have been defined when the thing was created.
One last workflow action that you should know about is delete a thing. Like modifying a thing, it’ll require you to set up a filter to select the thing to be deleted. Be especially careful with this action, as there is no workflow action that can reverse it. In the event you make a mistake and delete something you needed; you’re going to need to undo it using your application backup options.
This guide has hopefully taught you how to create and modify data elements in Bubble using workflows. While this may seem like a lot, it hasn’t even touched on how you can use this data in many useful ways, such as customizing your users’ experience and tailoring it to their needs. You can also use the data to make helpful statistics to show your users, or even for you to use to optimize your app’s features, if your users agree to it in your Terms and Conditions and Privacy Policy.
All these skills, and more no-code web support, can be found on the Bubblehelpers web page, and through Bubblehelpers’s technical consultation and support services.