- 13 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
Defined Data Structure CRUD Actions
- Updated on 13 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
Overview
Defined Data Structures represent information that can act as variables belonging to the object they represent. Using a Defined Data Structure, users are able to express or track information pertaining to each data field through a single object, rather than multiple individual ones. Defined Data Structures can also be used to extend an existing data type, create a custom type to subclass, create a subtype, or custom .dll.
Prerequisite
For this tutorial, a Defined Data Structure was created with the following fields:
DDPerson | |
Firstname | String |
Lastname | String |
DOB | Date time |
When the Storage Option setting has been set to Database Stored, the CRUD Flow steps will be created and the Data Structure will be saved in the Decisions database. Users will not need to create a normal Folder to store the records.
Create
- In a Designer Project, click CREATE FLOW and create a new Flow.
- In the Toolbox panel, navigate to USER DEFINED TYPES > DEFINED DATA STRUCTURES [ADVANCED] > DDPERSON category and attach a Create DDPerson step to the Start and End steps.
- On the Properties panel, set the mapping type of the Item to Create field from Unknown to Build Data.
- Set the FirstName, LastName, and DOB fields to Constant mapping and set values for each field.Auto-ID GenerationThe ID will be automatically created when the Flow runs even though its input value is set to Ignore.
- On the top action bar, click Debug.
- Click START DEBUGGING. This will open the Debugger and create a record for the Defined Data Structure.
Update
To update an existing record in a Defined Data Structure, use the Edit or Selective Update step. The Edit step will change every data field in the object, even if only one data field has been changed. The Selective Update step is used to change only one or more data field values and maintain the rest of the data field values. In order to change any record in a Data Structure, the Fetch Entities step will be required to fetch a particular record and then it will pass the Id of the record to be changed into either step.
Edit Step
- In the Flow Designer, attach a Fetch Entities step to the Start step to fetch all entities in the Defined Data Structure.
- Attach an Edit DDPerson step to the Results path. Set the ID field to Select From Flow and map in EntityResults.First.ID. Set Constant values to the DOB, FirstName, and LastName fields.
- Connect the No Results and Done paths to the End step.If the Edit step is used to change one field, that field will update with the new value and all unchanged fields will be set to null or empty.
- Click Debug on the top action bar.
- Click START DEBUGGING. The configured data record will be updated.
Selective Update Person step
- On the Properties panel of the Selective Update step, map in EntityResults.First.ID to the ID field under the INPUTS category.
- Under the DATA category, set the LastName field to a Constant value.
Delete
To remove records from a Data Structure, use the Delete step.