- 7 Minutes to read
What are the Data Types used in Datasets?
- 7 Minutes to read
Datasets organize their information using a few different data types. The data type matters when referenced in forms so it needs to be consistently maintained as the Dataset is managed. This article has a detailed explanation of the different data types used in Droplet Datasets, along with context about how they might be used with a form.
We recommend you read this article to understand the data types before you create or update Datasets for your organization.
The are two categories of data types available for Droplet Datasets:
Simple Data Types
Simple data types can be used alone and are often used to build complex Datasets by assembling them into Lists or Objects.
- Text - Text allows for a single value to be stored in the Dataset. It can be a word, phrase, sentence, or paragraph.
- True/False - The true/false data type limits you to two options - true or false. This might be helpful if you need to turn something on or off if certain conditions are met.
- Number - Number data types are a lot like text data types. They allow a single numerical value to be stored in the Dataset.
- Null - Null is another way to say blank or empty. On some occasions, you may need to indicate that a key has no value so you can use this null data type.
Complex Data Types
- List - Lists store data in a set order, just like you would write a grocery list. Forms can reference the entire list or just part of a list.
- Object - Objects have a key or a label and a value pairing. Forms will search the Dataset for the label that matches and return the associated value.
Or you can jump right into a complex Dataset example.
Text data is useful for storing names, email addresses, or any other data that needs to be used as part of the form, assignment, or notification email. This text will be stored in the field called Value in the Dataset editor.
Depending on whether the text is stored in an object, you may need to add a Label as well. Because labels can be reused in different objects, if I want to call the label for my administrator's name "name", I can use "name" in every administrator object.
Learn more about how Objects are used in Datasets below.
If you are familiar with programming languages, you may recognize this data type as a boolean.
For this data type, you have only two options: True or False. In the value section, you will be able to choose from a dropdown. Just like with other simple data types, if true/false is used in an object, it will need a label.
In the example to the right, some locations require the Superintendent to sign off their approval but others do not. I can use the data from this Dataset to indicate which locations require this extra workflow step and which don't.
Number data types are a lot like text data types except the data entered is required to be a number. Just like with other simple data types, if a number data type is used in an object, it will need a label.
Null is another way to say blank or empty. On some occasions, you may need to indicate that a key has no value so you can use this null data type. Again, if null is used in an object data type, it will need a label.
In this example, some locations have a list of budget codes they can use in the form but other locations don't and, so, don't need to enter budget codes. The form is set up to match this logic -- if a location has a list of codes, they can enter up to the number of codes available to them but if they don't have budget codes, this section will not display.
The list of budget codes at the Central Office location:
Using the null data type in the East Elementary School object to indicate this location does not have budget codes:
Lists are just that, a list of data.You can create a list Dataset containing any of the available data types so these can become complex as well but it is more likely that you will find a list as part of an object Dataset. If you are familiar with programming languages, this data type stores information as an array.
When a form references a list, it may use all items from that list or use certain elements based on which position they are in. This means lists do not use labels and values to return information as objects do. Instead, when a form is only calling for some items from the list, it will reference items using their position index or where that item is in the list order.
Here is a dataset called Locations made up of a list of text values:
Each item is numbered -- "Item 1", "Item 2", etc. to show you which position it occupies in this list. If a form were to ask for item 3 from the "Locations" Dataset, the data will return "East Elementary School". If a form were to ask for all items from the "Locations" Dataset, it would have access to the whole list.
While list-based Datasets may contain object data types, it is more likely that lists are composed of simple data types-text, true/false, number, or null values.
Datasets composed of object data types are the most common way to structure information on Droplet. They can be used in several ways though the basic premise of objects will remain the same. Each object, and the data inside it, contains label-value pairs. Each label will return everything stored in the value associated with it. This could be another object, a list, or any simple data type.
We can think of these labels as keys. Just like a specific key is required to open a locked door, when the matching key is found in an object, the door is opened and the value on the other side can come through.
In the example below, Administrators by Location is the name of the Dataset and it has a data type of Object. Within this Dataset, there are many Objects with a label for each location.
Each location object holds a Text data type to store the name of each administrator. The label for the administrator is the same for each location so when the form needs to reference the administrator at a certain location, the reference is consistent.
Labels can be reused as long as the same labels don't appear in the same object, so I could have multiple, unique objects for locations, and inside each location object, there could be an "administrator" object. The form can use the same key for the administrator door after it uses the unique key to unlock the location.
If you are familiar with using a code editor, you can see the whole Dataset in the code by switching to the code view.
How Droplet Forms and Datasets Interact Using Labels and Values in Complex Objects
Forms can continue using keys to unlock doors of data using as many keys as it has, no matter how complex an object becomes.
Below is an example of a Dataset that contains multiple data types within each of the location objects. The label and value structure of the object data type allows the form to access information specific to that location such as the address, administrator's name and email address, which budget codes they have access to, and whether this location requires superintendent approval.
Here, if a form has the keys for "North High School", "administrator", and "email" it could unlock "email@example.com". If it has the keys for "North High School" and "address" it could unlock "1000 North Way, Salt Lake City, UT 84044".
Here is the same Dataset from the code view.
This complex dataset contains a lot of information that can be updated as things change within your organization. Budget codes may need to be added or a new administrator might take a job at one of the locations. As long as the labels are maintained consistently while values are updated, the form will continue to function because it will still be able to access the information it requires.
If the lock is changed without updating the key, the key will no longer open the door. Changing a label without updating the form means the form will not have the correct data. This can result in a form submission with incomplete data or a workflow that no longer assigns to the next step.