Using Dynamic Form

Last Updated: 07/15/2016 Introduced in Verision: 2.0

This tutorial demonstrates how to use Flow Data input to the Form in order to make the Form dynamic.

 

Example:

In this example we will create a simple Flow with a Form in it. On the Form we will have a Text Box for user to input a ZIP code. After user inputs desirable ZIP code, the Form dynamically updates with City and State.

First, we need to create a Flow that will search for the City and State information according to the given ZIP. We begin in the Designer Folder with clicking Create Flow from the Folder Actions Panel.

 createFlow

Next, we Name the Flow and click Create to proceed to the Flow Designer.

 nameFlow

In the Flow Designer we select Start Step. Then, in the Step Information window we click Add New link to define Flow Input Data.

 addNewFlowInput

In the resulting window we define a Name for our Input, String Type, and check Can Be Null checkbox. Then, we click Ok to save and continue.

 defineInput

Next, we click Add Step button in the Step Information window for the Start Step.

 addStep

We expand All Steps [Catalog] > Data > List > Excel and Csv category and add For Each Excel Or CSV Row step. This step will iterate through our database (which is in csv format for this example).

 addForEach

On the Next Row outcome from the For Each Excel Or CSV Row step we add [Pick Or Create Rule] step from the Flows, Rules, Forms and Reports > Rules category.

 addRule

We Name the Rule and click Create to proceed to the Rule Designer.

 nameRule

In the Rule Designer in the Start Rule window we click Add New link to add inputs to our Rule.

 addRuleInputs

In the resulting Add Rule Input Data window we Name our Input, define its Type String, and click Ok to save and close this window.

 defineFirstRuleInput

In the same manner we add second input to our Rule. The purpose of this Rule is to compare user input ZIP with a ZIP in the current record in the database. We click Add New Rule Step button to start building the Rule Phrase.

 addNewRuleStep

In the Phrase Builder we pick Zip input and click Next.

 pickZip

In the Verb definition for the Rule Phrase we expand Equals category and pick Is verb. Click Next to continue.

 zipIs

Finally, we use Select Value Mapping Type, and with Path picker we select our second CurrentZip input.

 zipIsCurrentZip

This completes our Rule Design. We can save the Rule and close Rule Designer to return back to the Flow Design.

 ruleCompleted

Back in the Flow Designer, on the True outcome from the Rule we add Create Data step from Favorite Steps category in the Flow Designer Wizard.

 addCreateData

In the Create Data Step we define two String variables: City and State. Then, click Add to continue…

 addCityAndStateData

We connect the remaining outcomes from steps in our Flow as following…

 connectStepsInFlow

Then, we select For Each Excel Or CSV Row step… Using Step Information Window we define Input File Type as Csv. For File Input we use Constant zipcodes.csv file with data.

 pickDataFile

Next, we select our Rule, and choose Show Mapping Editor from step’s Options.

 showMappingForRule

In the Mapping Editor we connect Zip Flow Input (which will be user’s input) to the first input in the Rule. Then, we use Text Value from the First Field in the Current data row for the second input in the Rule (note that in our csv file for this example ZIP code is in the first column). Click Ok to save and close Mapping Editor.

 mappingForRule

Next, we call Mapping Editor for the Create Data Step. Here, we use City and State columns from the Current Row to populate Data Variables in the Create Data Step. Click Ok to close Mapping Editor.

 mappingForCreateData

Finally, we select End Step in our Flow. Then, we Add New output for our Flow.

 addFlowOutput

In the resulting pop-up window we use Pick from flow data link to add City output.

 pickCityDataOut

In the same manner we add State output to the Flow. This completes our Flow Design. This Flow takes in a Zip code and outputs City and State. We can close the Flow Designer.

 flowOutputsComplete

Now, we can create a simple Flow with a Dynamic Form. We click Create Flow, Name the Flow and click Create to proceed to the Flow Designer.

 nameSecondFlow

In the Flow Designer we add Show Form step from Favorite Steps category.

 addShowForm

Next, we Name the Form and click Create to proceed to the Form Designer.

 nameForm

Our Form should have a Button for the outcome, a Text Box for user input and Labels for informational purposes…

 formDesignBeginning

Then, we navigate to the Form Configurations, locate Data Flows box in the Form Data section, and click Add New link.

 addDataFlow

In the resulting Add Data Flows window we Name our Flow. Next, we pick the Flow that we have created previously in this tutorial to Get City and State by Zip. In the Flow Inputs we select Zip and click Edit.

 editZipInput

In the resulting window we select Form Component as an Input Type. From FormDataName we select Zip (which is a Data Name for the Text Box on our Form). Save and close this pop-up window.

 flowInputsEdited

Finally, in Triggers section in the Add Data Flows window we select desirable events that will cause this Flow to run. In this case we check Textbox 1 Exit, so when the user finishes inputting ZIP code and moves insertion pointer out of the Textbox, the Form will update with City and State. Click Ok to close this window.

 checkTriggers

Lastly, we need to add couple more Labels that will reflect Flow outputs. To accomplish this we check Text from Data Name checkbox in Label’s configurations, and click pick from data link.

 pickDataForLabels

In the resulting pop-up window we should be able to pick data from our Flow outputs. This finishes our Form Design. We can save and close Form Designer.

 dataForLabelsPicked

Back in the Flow Designer we simply connect Continue outcome from our Form to the End Step. Then, we click Debug Flow link on the top panel of the Flow Designer to test our Flow.

Note that in Decisions version 3.5 and above, you’ll need to click Test Flow to access the Debugger.

3.5 Test Flow Shot

 debugMainFlow

Our Form opens, and when we enter desirable ZIP code into the Textbox, the Form displays City and State

 firstTest

If we change ZIP code, Form updates with City and State

 secondTest

Mention, that user never leaves this Form or this Flow Step

 fourthTest

If we click Continue, the Flow runs to the End Step with no errors.

flowRanWithNoIssues

Additional Resources