Data Objects
In Workmaster, a Data Object serves as a blueprint for storing and organizing the data in your app. It defines the structure of the data, including the fields (attributes) that store the information, such as name, email, price, etc. Each Data Object can have various fields, and you can establish relationships between different data objects to link the information.
This guide explains how to create Data Objects, manage their fields, and set up relationships between them to build dynamic and interrelated data models in your app.
Creating a Data Object
Follow these steps to create a Data Object:
Click on the "Actions" button in the topbar of the Data Tab.
From the dropdown menu, select "New Data Object".
In the pop-up dialog, enter a name for your Data Object (e.g., Employees, Customers, etc.).
A new Data Object will be created with one default text field.
This newly created Data Object will now serve as a container for the data you wish to store and organize.
Adding Fields to a Data Object
Once you have created a Data Object, you can add fields to it, defining the attributes that will hold the data.
To add fields to a Data Object:
Open the Data Object you’ve just created.
In the Data Object Editor, click the "Add Field" button.
A dialog will open where you can:
Name the field (e.g., Name, Email, Price).
Assign a field type (e.g., Text, Number, Date).
After defining the field, click "OK" to add it to the Data Object.
Modifying Fields
You can modify existing fields in a Data Object. Here’s how:
Every field in your Data Object has a pencil icon (for editing).
To modify a field, click the pencil icon next to the field you want to edit.
The Edit Field dialog will open, allowing you to:
Change the field's name.
Modify the field type.
Once you're done, click "OK" to save the changes.
Deleting Fields
If you no longer need a field, you can delete it from your Data Object:
Every field in your Data Object has a trash icon (for deleting).
To delete a field, click the trash icon next to the field you want to remove.
Confirm the deletion, and the field will be permanently removed from your Data Object.
Creating Relationships Between Data Objects
You can create relationships between Data Objects to establish how they relate to one another. For example, a Customer might have multiple Orders, or a User might have one Profile. You can define a one-to-one or one-to-many relationship between two Data Objects.
To create a relationship between two Data Objects:
In the Data Object Editor, select the Data Object you want to establish a relationship for.
Click the "Add Data Object Reference" button.
A dialog will open, allowing you to choose the relationship type:
Object List: For a one-to-many relationship (e.g., one Customer can have many Orders).
Single Object: For a one-to-one relationship (e.g., each User has one Profile).
Choose the target Data Object that you want to reference.
Select the names of the reference fields in both the source and target Data Objects (e.g., Name in the source object and Name in the target object).
Click "Finish" to save the relationship.
This relationship ensures that data is linked correctly across the two Data Objects, enabling dynamic and relational data interactions.
Last updated