Data (Things)
This is the short-form technical reference entry describing how to work with data in Bubble actions. If you are looking for more in-depth and long-form articles on the subject, you may be interested in checking the Bubble Data manual.
Create a new thing...
This action creates a new entry in the application database, which we refer to as a Thing.
For the "Type" in this action's property editor, select an existing data type from the dropdown or define a new one by selecting 'Create a new type…' in this menu.
For example, you might select 'Event' from your list of data types. Once you do, and this action runs, a new 'Event' thing will be created into your application database.
When you click "Set another field," you can either choose from an existing field on that data type or create a new one. For example, if we already created a field for "Event name" in our Data Types tab, we can select this option and set it equal to an input's value. If we want to create a new field for "Start time," we can do so by selecting "Create a New Field" directly from the bottom of this dropdown.
Once you run this action, you can also see the matching changes in your Data tab, under Data Types and App Data.
Type
Choose the type of thing to create. Define a new type by selecting 'Create a new type...' in this dropdown menu.
Initial values
Click 'Add another field' to add a new field and specify a different value for that field. Select the field to modify, the operation, and the new value.
Make changes to thing...
This action modifies an existing entry in the application database. For example, if a user updates their first name, use 'Make change action' to the 'Current user's first name.'
Thing to change
Select which thing to modify.
Create if the thing doesn't exist
By default, this action does nothing if the thing you are trying to change does not already exist. Click this box to change this behavior. In this case, the action will be equivalent to 'Create a new thing' and will use the changes as initial values. Important: If the thing being changed, e.g., the 'Current user's thing,' does not exist, the thing will be created, but it will not be associated with the current user. Warning: This option has been deprecated on Jul 18, 2017. Applications created after this date will not be able to access it (but it will still be applied in run mode). Instead, users can use a condition on the action and create the thing if it does not exist in an action prior to the Change Thing action. We recommend users using this option to follow the same pattern as they upgrade their apps.
Changes
Add the modifications to apply to the thing currently being modified. Select the field to modify, the operation, and the new value. In addition to a simple action that assigns a value, other options are available, depending on the field type. If it is a list, choose from:
Add
Adds an item to the existing list. The type of thing should be of the same type as the field. If the item is already in the list, it will not be added.
Remove
Remove an item from the existing list. The type of thing should be of the same type as the field. If the item is not in the original list, nothing will happen.
Set list
Replace the current list with the new list. The value should be a list of things of the same type.
Add list
Add all the entries of the list defined to the existing list. If some items are already in the list, they will not be added.
Remove list
Removes all the entries of the list defined from the existing list. If some items are not in the list, they will not be removed.
Clear list
Deletes the content of the field and replaces it with an empty list.
Make changes to a list of things...
This action is equivalent to 'Make changes to a thing' but modifies more than one entry. Define a list of things to change, and each entry will be modified as described in the list of changes.
Type of things
Select the type of thing to modify. This is needed to test the type consistency with the actual list.
List to change
Define the list to modify. It can either be the result of a search or the content of a field that is a list of things. If the type is inconsistent, the expression will be red, and the action will not complete.
Changes
List the modifications to apply to the things currently being modified. Select the field to modify, the operation, and the new value.
Delete thing...
Deletes a thing from the database.
To delete
Select which thing to delete.
Delete a list of things...
This action is similar to 'Delete thing' but deletes more than one entry.
Type of things
Select the type of thing to delete. This is needed to test the type consistency with the actual list.
List to delete
Define the list to delete. It can either be the result of a search or the content of a field that is a list of things. If the type is inconsistent, the expression will be red, and the action will not complete.
Copy a list of things...
This action duplicates a list of things.
Important: For performance and security reasons, the number of things in the initial list is limited to 100 entries. If the length of the list exceeds this, the action will do nothing.
Type of things
Select the type of thing to copy. This is needed to test the type consistency with the list.
List to copy
Define the list to copy. It can either be the result of a search or the content of a field that is a list of things. If the type is inconsistent, the expression will be red, and the action will not complete.
Set a Thing's slug... [Beta]
This action modifies an existing thing's slug value.
Thing to change
Select the thing to modify.
Slug [Beta]
Specify the new slug value you want the thing to take.
Download data as CSV
This action enables users to download data as CSV. Use this to build your own admin page. End users are prompted to choose a destination for the file. This feature is available to users with a paid Bubble plan.
Type of data
Choose the type of data to export.
Data source
Define the list to export. It can either be the result of a search or the content of a field which is a list of things. If the type is inconsistent, the expression will be red, and the action will not complete.
File name
Enter a file name.
Date formatting
Select the date style to use. Choose from Excel friendly, Full (with time zone), and Custom.
Custom date format
Enter the custom date style to use.
Separator
Select the separator to use in the CSV file.
Include labels in first row
When this box is checked, the first row of the CSV file will include labels for the data.
Use field captions instead of IDs
By default, field IDs, which cannot be changed, are used as the column headers. Change this by checking this box. In this case, the captions defined in the Data Types section in the Data Tab will be used instead.
Note: 'Include labels in first row' must be selected to include the labels in the CSV file.
Wrap values in double quotes
When this box is checked, quotes are put around the data values.
Hidden columns
Select which fields should not be included in the CSV file.
Upload data as CSV
This action enables users to upload a CSV file and convert the items to things in the application database. Each column should match a field of the selected type. The fields should be of type text, number, date, address, and yes/no. This feature is available to users with a paid Bubble plan.
Important: This action is limited to uploading a number of items at a time, depending on your plan.
Type of data
Select the type of data to upload.
CSV file
Define the expression that points to the file to upload. Typically, it will use a file uploader element.
Separator
Select the separator to use in the CSV file.
Delete an uploaded file
This action deletes an uploaded file in your application storage. Only files uploaded by your application will be deleted. If the file is not found, the action will not do anything. Note that similarly to deleting files from the application editor, deleting a file does not modify things that refer to this file to wipe the URL at the thing level. If you wish to do this, you should do this first in your workflow.
Warning: Use this feature with caution as it permanently deletes your file. You will not be able to recover the deleted files.
File URL
URL of the file to delete. It should look like https://s3.amazonaws.com/appforest_uf//... or https://domain.com/fileupload/... for private files. Note that if the current user does not have permission to read the file, he will not be able to delete it.
Last updated