Creating Simple Database StructureLast Updated: 07/15/2016 Introduced in Verision: 2.0 |
A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. A data structure represents real or abstract objects through use of data members-basic units of information which can be thought of as variables belonging to the object you wish to represent. An example is a person data structure, and its attributes could be data like hair color, shoe size, and date of birth. Each data structure has unique properties that make it well suited to give a certain view of the data.
This data structure is used to create an entity that is stored in the Decisions database in a table created just for the data structure. Its limitation is that it can’t perform actions on itself or others. It relies on other components to manipulate it, and other entities to contain it, and steps in flow to create it. Essentially, it is a way to create a database table.
A Simple Database Structure is designed to create instances that are much like a single row of data in a database table. For example if we have a “Customers” table a single row will represent a single customer’s information as: CustomerID FirstName LastName …
With a Simple Database Structure we are able to create something similar and use this Structure to create complex instances like (Customer).
Example
In this example we are going to create Customer Data Structure using Simple Database Structure.
We begin in Designer Folder’s Action menu > Create Datatypes > Simple Database Structure
Note: In Decisions 3.2 this Action is renamed to Database Structure and can be found under Datatypes/Database > User Defined Types category on the Folder Actions Panel.
In the resulting popup window we Name our structure (Customer) and click Add to add a new field to our customer record. This simply adds Data Members to our datatype.
In the resulting popup window we Name our Data Member (CustomerID) and define its type as Int.
We click Ok to close and save this data member.
The same way we add as many Data Members as we are going to need for our “record”. Next, click Ok to save Data Structure and close Edit window.
To test our Structure we Create New Flow.
In the Flow Designer start-up window we select Create or Copy Data step in the All Steps [Catalog] under Data category and click Add to add it to our workspace.
Under Data Definitions options we click Add New link to add new Data Definition.
In the resulting popup window we name our Data Definition (NewCustomer). Next we click Type picker and search for our Database Structure that we created before. We choose it as a type of our Data Definition and click Ok to save and close this window.
Under Inputs options now we can see our NewCostumer. From its Mapping Type we pick Constant and click on Value to define values for our fields. After we finished we click Ok to save. And now we can use our NewCustomer as a single object with all its properties.