Extend Flow With Data From DatabaseLast Updated: 07/18/2016 Introduced in Verision: 2.0 |
This tutorial demonstrates how to extend Flow with data that is coming from the database table. In Decisions 3.2 it is possible to interact with database tables from any Designer Folder. This can be achieved by using available options from Datatypes/Database > Database Integration menu on the Folder Actions Panel.
Example:
We begin in the Designer Folder with navigating to the Datatypes/Database > Database Integration menu on the Folder Actions Panel. This menu contains several options of interacting with database table. We click Add Table.
Database Integration window pops up. If we want to get data from the database that Decisions has already been integrated with we can pick the Existing connections from the drop-down list.
In this example we Create a new connection. We fill in all required fields and check the connection by clicking Test button.
System is checking the connection…
If connection is successful we can click Next to continue.
In the resulting window we pick table from Table Name drop-down list. After we picked a table, we can configure data that comes from the table in the best suitable way. For instance, we can choose what fields from the table we need, define key fields, and pick the steps that system should generate for us to use in workflows. Then, we click Ok to save this integration.
In our Designer Folder system creates Database Table Definition.
To use the integration that we have just created we click Create Flow from Folder Actions Panel.
Then, we Name the Flow and click Create to proceed to the Flow Designer.
In the Flow Designer we can find the steps that system has generated for us to interact with database table under Integrations > My Integrations > Database > [Database Name] > [Table Name] category. For this example we add Get all from dbo.Employees step.
Next, we connect both outcomes from this step to the End step in our Flow, and Ignore Limit Count input to the step.
To test our Flow we click Debug Flow from the top panel of the Flow Designer.
Note that in Decisions version 3.5 and above, you’ll need to click Test Flow to access this function.
Our Flow runs without any errors. If we check what data outcomes from the Get all from dbo.Employees step, we can see data from the table we have integrated with. Then, we can close Flow Designer to return back to the Designer Folder.
Next, we click Datatypes/Database > Database Integration > Add Query option from the Folder Actions Panel.
Database Integration window pops up and we pick an Existing connection this time. Click Next to continue.
In the resulting window we configure our Query. We provide our query with Name and define it in the Query text block. Then, we click Run Query button.
In the Check Query window we should be able to see the Results of our query.
If we click Dynamic Type tab we will see the type that is being generated by the system for us to use in the workflow. Additionally, we can choose the way that data should be represented by selecting one of the options from Return Data Option drop-down list. In this case we use Create Type option. When finished query configuration, we can click Ok to save it.
System creates Query Definition in our Designer Folder.
To test this query, we Edit the Flow that we have created previously in this tutorial.
In the Flow Designer we delete Get all from dbo.Employees step from the workspace. Then, we find our Run query QueryNames step under Integrations > My Integrations > Database > [Database Name] category, and add it to our Flow.
Next, we connect outcomes from Run Query step to the End step in our Flow, Ignore Limit Count input to the step, and click Debug Flow link to test the Flow.
The Flow runs with no issues and we can confirm that Run Query step outputs expected data according to our Query definition.