Defined Data Structure CRUD Actions
  • 16 Jun 2022
  • 2 Minutes to read
  • Dark
    Light

Defined Data Structure CRUD Actions

  • Dark
    Light

Article summary

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. 

CRUD Action Steps: Defined Data Structures [Advanced]
In the Toolbox, Create, Update, and Delete steps cannot be searched for. Users will have to navigate to USER DEFINED TYPES > DEFINED DATA STRUCTURES [ADVANCED] to add CRUD actions to the workspace.

Prerequisite

For this tutorial, a Defined Data Structure was created with the following fields:

DDPerson
FirstnameString
LastnameString
DOBDate 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.

Do Not Store Data In The Configuration Folder
Data Structures that are a part of the Decisions Entity Framework will automatically have a Configuration Folder. Do not store data within that Folder. The Configuration Folder is meant for creating Flows, Rules, and other Designer elements to enhance that custom data structure. For more information, please navigate to the Configuration Folder article.

Create 

  1. In a Designer Project, click CREATE FLOW and create a new Flow.  
  2. 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.
  3. On the Properties panel, set the mapping type of the Item to Create field from Unknown to Build Data.
  4. Set the FirstName, LastName, and DOB fields to Constant mapping and set values for each field.
    Auto-ID Generation
    The ID will be automatically created when the Flow runs even though its input value is set to Ignore.
  5. On the top action bar, click Debug
  6. 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

  1. In the Flow Designer, attach a Fetch Entities step to the Start step to fetch all entities in the Defined Data Structure.
  2. 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. 
  3. 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.
  4. Click Debug on the top action bar.
  5. Click START DEBUGGING. The configured data record will be updated. 

Selective Update Person step

  1. On the Properties panel of the Selective Update step, map in EntityResults.First.ID to the ID field under the INPUTS category. 
  2. Under the DATA category, set the LastName field to a Constant value.


Delete

To remove records from a Data Structure, use the Delete step.



For further information on Data Structures, visit the Decisions Forum.

Was this article helpful?