Sub Dialog Data FlowLast Updated: 07/13/2018 Introduced in Version: 4.0
This tutorial demonstrates how to create and use Sub Dialog Data Flow in Decisions. Sub Dialog Data Flow was introduced in Decisions 4.0. Sub Dialog Data Flow works in the similar manner as Data Flow on the Form, except in Sub Dialog Data Flow we can use Forms for user interactions. These Forms will show up in a Sub Dialog window.
In this example we are going to demonstrate how to create and use Sub Dialog Data Flow.
For this example we integrated Decisions with Northwind database Customers table and added Access Pattern to Customers table by Country field.
We start in Designer Folder with clicking Create Flow on Folder Actions Panel.
In the resulting window we Name the Flow and pick Sub Dialog Data Flow behavior (specific Flow Behavior that can be used for Sub Dialog Data Flow on the Form). Then, we click Create to proceed to the Flow Designer.
In the Flow Designer we can see a Start Step and two End Steps: Change Data and Cancel. If our Flow executes on Change Data End Step, our Flow will act as Data Flow and output/change Data on the Form it was called from. If our Flow executes on Cancel End Step, we should not output any Data back to the calling Form.
Next, we select Start Step, click Add New Flow Input Data, and define Country String. This variable will be coming from the calling Form and serve as a search criteria in this Sub Dialog Data Flow.
Then, we add Access Customers By Country (Access Pattern for Customers table) from Integrations > My Integrations > Database > Northwind (Database) > dbo.Customers (Table) category.
Next, we select Get Customers By Country step on the work-space and click Edit Input Mapping.
In the Mapping Editor we connect Country Flow Input Data to Country field. For Country Match Type we select Constant Equals. When finished, we click Ok to save and close Mapping Editor.
Back in the Flow Designer we connect Failed outcome from the Get Customers By Country to the Cancel End Step in the Flow. On Done outcome we add Show Form step from Favorite Steps category.
In the resulting window we Name our Form and click Create to proceed to the Form Designer.
We design this Form as following… We use one constant ‘Customers In’ Label and one Dynamic [Country] Label (from Flow Data > Country (value)). Also, we have Done Button control for user to be able to submit this Form. The list of available Customers we display with Dynamic Data Grid control from List category. We pick Northwind_dboCustomers Type for the grid and this Data Grid Mode is set to be SingleSelect to output single Customer. When finished, we Save the Form and close Form Designer.
Back in the Flow Designer we call the Mapping Editor for our Pick Customer Form.
In the Mapping Editor we map Customers_Result outcome from Get Customers By Country to Customers Dynamic Data Grid control on the Form. We click Ok to save and close Mapping Editor.
Back in the Flow Designer we connect Done outcome from our Pick Customer Form Step to the Change Data End Step. Select Change Data End Step on the work-space and click Add New Output Data. In the Add Data pop-up window we name our Data and select Type as our Northwind Customer Table. We click on Pick from flow data link and pick selectedCustomer output from Dynamic Data Grid control. Click Ok to save and continue.
This completes our Sub Dialog Data Flow. We can save the Flow and close Flow Designer.
Next, we are going to build a simple Flow with a Form to demonstrate how to use Sub Dialog Data Flow.
In the Designer Folder we click Create Flow on the Folder Actions Panel.
Then, we Name the Flow and click Create to proceed to the Flow Designer.
Our Main Flow will only have a Form.
In the Flow Designer we add Show Form Step from Favorite Steps category.
Then, we Name the Form and click Create to proceed to the Form Designer.
In the Form Designer we add Label and TextBox (for user input). Then, from Sub Dialog Data category, we add Sub Data Flow Button. This control allows to run Sub Dialog Data Flows.
Next, we are going to configure our Sub Data Flow Button control. First, we provide Text to be displayed on the Button control (Pick Customer).
Then, using Flow ID picker we pick a Sub Dialog Flow that we created previously in this tutorial.
After we pick our Flow, we need to Edit Flow Inputs because our Sub Dialog Data Flow has Country Flow Input Data.
In the Edit Flow Inputs window we pick Form Component InputType, and Country Text Box from FormDataName drop-down. Click Ok to save and close this window.
Next, we are going to use Label components to display information that our Sub Dialog Data Flow returns to us. We pick Label component, then check Text from Data Name check-box in Common Properties. In Data Name we click pick from data link. Then, we expand Flow: selectedCustomer output and pick desirable property (ContactName).
In similar manner, using Label components we display other fields from selectedCustomer Sub Dialog Data Flow output. This completes our Form design. We can Save Form and close Form Designer.
Back in the Flow Designer we connect Done outcome from our Form Step to the End Step in the Flow. This completes our Flow. We can click Debug Flow on the top panel of the Flow Designer to test our Flow.
Our Form opens in the Debugger. We enter Country in the Text Box (USA) and click Pick Customer.
Our Sub Dialog Flow triggers and opens a Form in a new sub-dialog window. It displays all Customers from USA based on our input on the Main Form. We pick a Customer and click Done.
Our Sub Dialog Form closes and Labels on the Main Form are updated with the Customer information that we picked in the Sub Dialog.
Then, we can input different Country (Mexico) and click Pick Customer again. Sub Dialog Form opens with all customers listed in Mexico. We pick one and click Done.
Sub Dialog closes and Labels on the Main Form are updated with the picked in Sub Dialog Customer information. We click Done.
Our Flow executes to the End Step with no issues.