Return Dynamic Data Rows When Fetching Data From Database
  • 17 Oct 2022
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Return Dynamic Data Rows When Fetching Data From Database

  • Dark
    Light

Article summary

Overview

Decisions has the built-in capability to integrate with an external Database. Once the connection has been set up, users can manipulate and extract data from the database table within the Flow Designer. When Fetching Data from an external database, there are times when the schema of the returned data will change or be dynamic. This data can be handled dynamically.

Example

In this example, data will be fetched from a database table, established as Dynamic Rows, and displayed on a Form. Below is a downloadable example to import.


  1. Integrate with a dbo_entity_account table from the database. 
  2. To do this, go to System > Integrations > Databases > Local Connection > Add Table.

    Add-table.jpg

  3. Select the desired Object to use for the Flow. 
  4. In this example, use dbo.entity_account.

    dbo-1.jpg

  5. Select or deselect the properties needed.

    2018-08-15_153806-1.jpg

  6. Start in a Designer Folder, and create a Flow to open the Flow Designer.
    To learn more about how to create a Flow, click here.
  7. In the Flow Designer, navigate to the Integrations > My Integrations > Database > Local Connection > dbo_entity_account (Table) category. 
  8. Within the specific database table, select the Get all from dbo_entity_account step.

    2019-09-20_104203.png

  9. Configure the settings on the Get all from dbo_entity_account step.  
  10. In the Properties panel on the right under Output Settings, select the Data Rows option from the Return Data Option drop down list.

    2018-08-15_162158.jpg

  11. Locate the For Each step in the Steps panel and add it to the Flow.

    2019-09-20_115050.png

  12. In the Properties panel on the right under Data, choose the Type from the drop-down list. 
  13. Locate the database under User Defined Types > Database (Advanced), then select the specific database being called for the Flow.
    Note:
    Under Outputs on the For Each step, a single Dynamic Data Row item has numerous fields that can be used in the Flow to display data.

    2018-08-15_161129.jpg

  14. Next, add a [Pick or Create Form]step to the Flow.

    2019-09-20_104410.png

  15. Now create a Form that will display the Dynamic Row. 
  16. First, locate a Label control and drag three onto the Form. 
  17. Set the labels to Dynamic so they will display data from the Flow.
  18. In the Properties panel, under Common Properties, check the box "Text from Data Name" and supply data names (Item Field 29, Item Field 39 and Item Field 21) that will represent the field. 
  19. Locate the drop down under Validation Source and under Asterisk for a required field, select Dynamic.
  20. Save and close to return to the Flow Designer.

    2019-09-20_110503.png

  21. Select the Form to edit the Inputs.
  22. The three labels can be specified to the database here.
  23. Set Item Field 29 (this will be the first name), Item Field 39 (this will be the last name) and Item Field 21 (this will be the email address) to mapping type Select From Flow
  24. Choose the corresponding Item.Field#.TextValue for each label.

    2019-09-20_110405.png

  25. Assemble the Flow using the image below. 
  26. Debug the Flow to see the rows dynamically populated from the database.

    2019-09-20_105026.png

  27. When the Flow Debugger runs, the field values are displayed on the Form. 
  28. In this example, the first name, last name, and email address fields were chosen. 
  29. The first few accounts do not have a first and last name specified, so these values are empty.
  30. Clicking the Next button will step through each row in the database table and display the fields that were specified.  
  31. The example stops at 10 because on the Get all from dbo_entity_account step, the Limit Count was specified to be 10.

    Video_2019-09-20_110659.gif


Was this article helpful?