Data Sources

Data sources are where you get your data from when building a dynamic expression. It is going to be the first section of the expression. Sources of data can be the current user, a search from the database, data from an external API, some page and browser information, etc.

Current user

This represents the current user using the app. The user can either be logged in, in which case you have access to their email, etc., or logged out. If the user is logged out, you can still modify the user object, but once the user closes their browser, you will not be able to access the user's information.

Signed up users

If a user has signed up to Bubble (with an email and a password), a permanent entry is created in the database using this email and password. When a user opens your app in a new browser (without cookies) and enters his credentials through a login workflow, he will be logged in. The value of 'Current user is logged in' will return yes. If you modify the current user, this will be saved permanently on the database object, and if the user logs in on another device, he/she will have the changes applied to his account there as well.

One important consequence of this is that all users that can be found through searches in the database will be marked as 'logged in' on the server, as they are permanent accounts.

Temporary users

As soon as a Bubble app is opened in a browser, a user session is created. If a user already logged in and hasn't cleared the cookies, the session will be using the same user as before, but in the case of a fresh session (without a logged-in user), a temporary user will be created. This user will be marked as 'not logged in' (in other words, 'Current user isn't logged in' will return yes).

The temporary user behaves like a signed-up user, in the sense that you can modify them, and it will be saved to the application database. If a user comes back using the same browser and hasn't cleared the cookies, any value that you have used to modify a field on the user will be the same. Bubble automatically clears temporary user data, though. After three days, such a user will be deleted, and when a user opens a session in the same browser, a new temporary user will be created, for three days.

When a user first visits an application, they will be seen as a temporary user. If they go through a sign-up workflow, the current temporary user will become a signed-up user and will be saved permanently in the database. This has some important consequences in terms of workflow design. Imagine you have a workflow that asks a user for their age before they sign up and saves it to the 'Current user'. If the user effectively signs up within three days, the permanent user that will be created then will have the same 'age'.

Do a search for

Use this to search for entries in the application database. Define what type of things to look for, which will either be User or a custom data type defined by you, and also specify a sorting order and constraints. The constraints can be on any field, such as name contains 'peter,' address is within 1 mile from the 'User's current position,' etc.

Please note that database queries (ie. “Do a search for”) are bound to a 5 second limit, so anything that takes longer than this to execute will trigger a timeout and subsequent error. For example, some “heavy” queries might look like:

  • Searches on data types with over several hundred entries

  • Searches on data types with custom fields containing several hundred entries

  • Searches involving multiple :filters, :sorts, advanced filters, and/or complex search constraints

To prevent against this, we recommend following the best practices outlined here for building more efficient queries: General principles & tips about performance.

Perform a search using Algolia

Use this to search entries in your Algolia indices. Define the type you want to search across and what field to query, as well as the query itself

Get an option

Get either a specific option from any option set, or a list of all options from that set.

Arbitrary text

Use this to manually enter a static or dynamic string of text. The text entered will resolve to type Text and can be further modified with any of our text type operators.

Arbitrary date/time

Use this to manually enter a date/time. Most human-readable formats can be parsed.

Get data from an external API

This option fetches data from the outside world through one of Bubble's Plugins. For example, Google Places returns a list of places based on an address and a term, i.e., what you're looking for. Usually, an API call will require parameters. Define what they should be in the Slidable Palette. These parameters can be dynamic, using 'Insert dynamic data.' The type of data this source returns depends on the plugin. It can be a list of places to display on a map or in a repeating group, a single entry to display in a group or text, etc.

Parent group's thing / Current cell's thing

This is a way to refer to the 'Parent element's value.' For example, when using a repeating group that displays a list of users, each cell will have a different user in it. The 'Current cell's user' will represent that user. The type is the type of content of the container.

Current cell's index

This allows access to the number of the current cell in a repeating group. The first cell will be 1, the second will be 2, etc. This is useful to display a rank or change the formatting of some elements based on the number.

Current page thing

If you have set up a page to have a type of content, this source is a way to refer to it. For example, when building a rental marketplace, you will likely have a page with the details of each apartment. This page will have a type of content 'Apartment,' and then a link will open that page sending a given 'Apartment' to it. Refer to the 'Current page's apartment' with this option. Then, you will have access to all the data that the apartment has, such as picture, address, etc.

Element

This source is a way to refer to an element and access its states, like hovered, value, etc. For example, this is how to get an input's value.

This element

This source is a shortcut to find the current element being editing. You then have access to its states.

Result of previous step

This is a way to refer to the result of a previous step/action in a workflow. For example, when using a 'Create a new thing' action to create an 'Apartment,' the subsequent actions will be able to refer to the result of step one and use the new 'Apartment.'

Current Workflow thing

When using custom workflows, you may want a workflow to modify an object you sent to it. The Current Workflow thing is this object. Its type will be the type of the custom workflow being used.

Thing Now

Thing Now represents the new state of the data after a data change, used in the context of a data change trigger workflow. It's up to date with the latest state of the thing and can change over the course of the workflow.

Thing Before Change

When the data changes, you may want to access the old state of the data throughout your data change trigger workflow. Thing Before Change is the data from before the data change.

Get data from page URL

This source is a way to capture the value of a parameter in the URL of the current page or path. For example, the current page's URL is 'yourdomain.com/yourpage?age=23.' Set the source to get the 'age' parameter, and in Live mode, that will return 23. When specifying a parameter, it is case sensitive. We recommend using all lowercase and avoiding special characters, spaces, etc.

If you select path, you can retrieve 'hello' in the URL 'yourdomain.com/yourpage/hello.' Choose the type of data that this parameter should have, and then use this data as such in the Bubble Editor. If you choose a type of data that is a custom type or the type User, the value of the parameter in the URL should be the thing ID, not its slug. Caution: This is an advanced feature.

Note: Because URLs only allow some characters, special characters are encoded with a percent symbol preceding an identifier for that character. For example, spaces may become "%20" in the browser.

When using the Get data from page URL operator to extract a parameter with a space in it, we will return the parameter as it appears in the URL, not as it is normally written . For example, we we wanted to extract the value of "param" from the following URL:

website.com/mypage?param=my%20parameter => my%20parameter

However, when using the Get data from page URL operator to extract the path, we will return the path parsed as it is normally written, not as it appears in the browser. For example, if we wanted to extract the path from the following URL:

http://website.com/mypage/this%20path => this path

Current option/thing

Some elements allow access to the current option. For example, when using a dropdown element with dynamic options, e.g., users, you want to define how to name the different options. Choose 'Current option's email' to have the dropdown menu show a list of the users' emails.

API workflow parameters

These are the different parameters the API workflow has access to. When working on an API workflow, define parameters at the Event level with a value. Choose the relevant entry in the top section of the dropdown menu to access the value of the parameter.

Calculate formula

This source calculates more sophisticated numerical calculations, like loan interests, etc. Reach out to us if you need more options.

Page data

This source allows access to the page information.

Website home URL

This returns the home of the app. If the user is on https://yourdomain.com/a_page, it will return https://yourdomain.com.

This URL

This returns the exact URL of the current page.

Tip: If you use this as a data source on your live app, use this on yourdomain.com rather than yourdomain.com/version-live/ to prevent /version-live/ from being included in this link.

Current language

This returns the current language the app is using. This can be controlled in a few ways, by order of priority: – lang parameter: Set &lang=english, for instance, as a querystring in the URL. – A field on the current user: If you set a field in the Languages section in the Settings Tab and modify this field for the current user, this value will be the current language. – The app's primary language: Defined in the Languages section in the Settings Tab. In each case, if the value returned is not one of the available options as shown in the dropdown menu in the Languages section in the Settings Tab, the next option will be used.

Current page name

This returns the current page name. Use it in reusable elements, so that the element can have knowledge of the page it is used in.

Website admin email

This returns the admin email of the app. Without a paid Bubble plan or domain, the email will be [your-appname]-no-reply@bubbleapps.io. With a paid Bubble plan and domain, the email will be what is set in the Domain & Email section in the Settings Tab. Use this instead of hardcoding the email because it can change over time, such as signing up for a paid Bubble plan.

Current date/time

This returns the current time on the user's computer. The type is date.

Current geographic position

This returns the current geographic position of the user, provided it is shared. The browser will prompt the user to do so. The type is geographic address.

Tip: If you use "Current geographic position" in a workflow, the user will need to accept geolocation in order for that workflow to run successfully.

Current page width

This returns the page width in pixels. This is useful when building responsive pages.

Current page scrolling position

This returns the number of pixels between the top and current page scroll position.

Page loaded above fold

This returns no/false initially, and then true when every element is visible above the fold, i.e., visible given the height of the user's web browser and has finished loading any data needed to display it. Use this to selectively cover things up until the entire page is ready to be displayed to avoid ugly loading artifacts.

Note: If an element starts as invisible while this is false, it will not start loading until this becomes true. So, to hide a slow-loading element, cover it up with something else, such as a Shape element.

Page loaded (entire)

This returns no/false initially, and then true when every element is visible on the page and has finished loading any data needed to display it. Use this to selectively cover things up until the entire page is ready to be displayed to avoid ugly loading artifacts.

Note: If an element starts as invisible while this is false, it will not start loading until this becomes true. So, to hide a slow-loading element, cover it up with something else, such as a Shape element.

Is Dev environment

This returns yes/true when the app is in any of the Development .

Branch name

This returns the current name. The Main branch is always called version-test.

Application Text

When handling more than one language for the app, define Text IDs and use them in the Bubble Editor. Then, set the language in the Languages section in the Settings Tab. For example, when adding a new button, in the dropdown menu to define the text, select 'Insert dynamic data' and then 'App text (?).'

Incompatible type for inputs

If an input doesn't have the right type of data, you will not be able to choose it in the dropdown menu. For example, when you want to do a search on the creator of the thing you're searching and want the creator to equal the value of a dropdown menu that lists users. If you haven't set the type of the dropdown element to user properly, you will not be able to select it. The way to select it is to change the type of element at the Dropdown element level.

Other ways to learn

User manual articles

Our article series below dives deep into what data sources are, and how you can use dynamic, static and temporary data to when you build your app. If you are new to Bubble we recommend getting to know this chapter:

  • Article series: Data

Video lessons

Last updated