- 12 Mar 2021
- 2 Minutes to read
- Print
- DarkLight
CRUD and User Actions
- Updated on 12 Mar 2021
- 2 Minutes to read
- Print
- DarkLight
Overview
Example Lab Details | |
Version | 6.13.0 |
Root Folder | Example Lab - CRUD in User Action |
Modules | None |
Dependencies | None |
This project details the basic process of CRUD operations as well as how to execute them from a User Action Flow.
Explanation
This project allows the user to modify data structure entities using CRUD actions. CRUD (Create, Read, Update, and Delete ) refers to the Flow steps that are auto-generated by data structures capable of writing to the database. In this example there are three main flows that utilize the Create, Read, Update, and Delete steps.
The first Flow utilizes the Create step in order to create ten random data entries to the person Entity. This is accomplished by using the Random First Name, and Surname steps which are readily available in the Decisions step catalog. In order to create a random letter grade for each person, the Flow utilizes a Random Integer Generator and a Truth Table. Each number 0-4 is then associated with a corresponding letter grade in the truth table and the output from the truth table is mapped to the grade input data point for the Create step. These five steps are executed 10 times by using a ForEach step with a constant input of 10.
The second Flow utilizes the Edit step as well as the Get All Person step in order to edit any user-selected Person(s). When the Flow is run a Form is displayed to the user containing a Data Grid with all of the existing Person data entries, this data is provided by the Get All Persons step. The user can then select as many people as desired to edit. In order to allow this Flow to edit more than one person at a time the ForEach step is used to iterate through each selected person and edit them individually. With each iteration of the ForEach step, a Form is displayed to the user with two text boxes and a drop-down list all prepopulated with the current selected person's information. The user may then edit any of the three fields and click the "Save Changes" button to update that person. This process will repeat until all of the initially selected people have been edited.
The third Flow utilizes the Delete step, as well as the Get All Persons step in order to delete any user-selected Person(s). This Flow works very similarly to the previous Flow in that the user is displayed a Form with a Data Grid containing all existing Person(s) and the user selects which items to be deleted. These items are then passed to a ForEach step which will iterate through the Delete step until they have all been removed.
In the "Person Configuration" Folder there are also 5 user actions that can be run to assign the corresponding letter grade to any of the existing Person(s). In order to run these Flows the only input needed is the Entity ID of the Person for which the grade is to be assigned.