Return Dynamic Data Rows When Fetching Data From Database
- Updated on 17 Sep 2014
- 2 minutes to read
Database Entities represent external databases which can be integrated with a flow. To add a database within the portal, navigate to the folderSystem>Designers>Integrations>Databases , click Add Table. Once a database is introduced we can manipulate and extract data from the database table from within the Flow Designer. To add a database table to the Flow Designer go to Integrations>My Integrations>[database Name]> [Table Name].
When Fetching Data from an external database it can be difficult to pinpoint the data's type. Decisions has the ability to handle this dynamic data for us.
In this example, we are going to fetch data from a database table, establish it is as Dynamic Rows, and display it on a form. For this example, we will integrate with a dbo_entity_account table from the Decisions database. To do this go to System > Integrations > Databases > Add Table > select the database name from the drop-down list.
Select the Object you wish to use for the flow. In this example, dbo.entity_account is used.
Select or unselect the properties needed.
Start in a Designer Folder, Create a Flow to open the flow designer. In theFlow Designer, add a Get all from database step. Navigate to Integrations > My Integrations > Database > (Select your specific database connection) > dbo_entity_account (Table) category. Within the specific database table, select the Get all from dbo_entity_account step.
Next configure the settings on the Get all from dbo_entity_account step. In the properties tab on the right under Output Settings select the Data Rows option from the Return Data Option drop-down list.
Next, locate the For Each Step in the Steps Tab and Add it to the flow. In the properties tab on the right under Data choose the Type from the drop-down list. Locate the database under User defined Types>Database (Advanced), then select the specific database that is being called for the flow.
Note: Under Outputs on the For Each Step, a single Item that is of the type Dynamic Data Row and has numerous fields that we can use in the flow to display our data.
Create a Form
Next, add a [Pick or Create Form] step to the flow. Now create a form that will display theDynamic Row. First, locate a label component and dragtwo onto the form. Set the labels to dynamic and they will display data from the flow.
To accomplish this in the Properties Tab , underCommon Properties check the box, (Text from Data Name) and supply a data name that will represent the field. Locate the drop-down under Validation Source and underAsterisk for a required field, selectDynamic .
Save and close to return back to the Flow Designer . Select the Form to edit the Inputs, here the two labels can be specified to the database. Set Item Feild 1 and Item Feild 2 to select from the flow. Here specify what input to select from the database.
Assemble the flow using the image below. Next, debug the flow to see the rows dynamically populated from the database.
When the flow debugger runs the field values are displayed on the form.
Clicking the Next button will step through each row in the database table and display the fields that we specified.