- 23 Nov 2020
- 4 Minutes to read
Using Data Flow In a Form
- Updated on 23 Nov 2020
- 4 Minutes to read
Decisions has the ability to run additional flows from a form. These can be triggered automatically or run based on user interaction. For example, a field on the form will change based on what the user inputs on a different control. The flow within the form will run and push data back to the form. The following example shows the features of Data Flows in a Form.
Create a Form where the user will input a long date (Month Day, Year) into the Text Box and the Data Flow will convert the long date to a short date format and appear in the Date Picker.
In a Designer Folder, select Create Flow in the bottom action panel.
In the Create Flow dialog, click Default then Create. This will populate the Create Flow dialog to name the Flow, name the flow then select CREATE to proceed to the Flow Designer.
Select the Start step on the workspace which will bring up the Quick Add for Step dialog. In the Quick Add for Step dialog under the Favorite Steps tab, chose Show Form, then select ADD.
Once ADD is selected the Default Editor for Step dialog will appear. Name the Form, “Convert Text To Date”. Select Create.
The Form Designer will appear with a blank workspace. To create the form this example calls for, under Favorite Components click and drag Button to the bottom right-hand corner of the form.
Also, click and drag a Text Box to the form and name it “Long Date Format” simultaneously select (Shift+Enter) to add a Label above the Text box.
In the Form Controls panel, expand Data then click and drag Date Picker and simultaneously select (Shift+Enter) to add a Label above the Date Picker.
Select the workspace, the empty area outside of the form, white and grey checkered. In the Properties panel, navigate to the Form Rules tab. Under Data Flows select Add New.
An Add Data Flows dialog will appear. Name the Flow Data, “ConvertTextToDate”, under Flow select Create.
This will populate a Create New Flow dialog. Under Name, type “ConvertingDate” then select OK.
Now the Data Flow can be created. Navigate to the Steps panel, in the Search bar type Convert String. Click and drag Convert String to Date to the workspace. Connect the Done arrow from the Start step to Convert String to Date. Then connect the Done arrow from the Convert String to Date to the **End step connect the steps.
Select the Start step to view the properties panel. In the properties panel under Flow Input Data select Show Editor.
In the Data Definitions dialog, type “Long Date Format” under Name. Leave Type as String [Text]. Click CLOSE to exit out of the Data Definitions dialog.
Select the Convert String to Date step in the workspace. Under Inputs > String to Convert, change the mapping type to Select Value [From Flow]. Click Pick under the Path field.
The Pick Data dialog will appear, in the dialog select Long Date Format then at the bottom of the dialog select Pick. Notice under the Outputs tab the mapping type is already set to Rename and the Name is Converted Date.
Select the [EndStep] in the flow designer. Under Data > Output select Show Editor.
In the Data Definitions dialog type “Short Date Format” under Name. Change Type to Date Time. Under Inputs > Short Date Format, click Select Value [From Flow] for the Mapping Type. Click Pick under the Path field. In the Pick Data dialog, click on Converted Date then at the bottom of the dialog click Pick. Select CLOSE to exit out of the Data Definitions dialog,
[output data type screen shot goes here]
Now select Close Flow in the top panel. The Save dialog will appear, click Save. The Flow Designer will close and Add Data Flows will appear again. Select Update Inputs to generate the Inputs and Outputs that were just created in the Flow Designer.
Once the Flow Inputs and Flow Outputs are updated, select the pencil icon next to Long Date Format [String].
The Edit Flow Inputs dialog will appear. From the Input Type, drop-down menu select Form Component. From the Form Data Name, chose Long Date Format. Unselect RunOnValueChanged. Select OK to exit from the Edit Flow Inputs dialog then select OK to exit from the Edit Data Flows dialog.
Back in the Form Designer select the Date Picker control, navigate to the properties panel. Under Data Name select Pick from Data.
Save and close the Form Designer.
The original Flow that was named “TextToDate” will appear.
Select Debug on the top panel.
The Debugger will appear, select the run button in the middle of the screen to initiate the Debugger.
The form will appear allowing you to enter a Long Date Format and the Short Date Format will populate as you exit the Text Box.