Evaluate Dynamic ExpressionLast Updated: 07/25/2016 Introduced in Verision: 2.0
Expression Steps are specially designed to evaluate calculations in one step within a Flow. These Steps can be found under Data > Numbers Category in the ToolBox in the Flow Designer. The Evaluate Dynamic Expression Step is unique in the way that it allows end User to evaluate any expression. In other words, we can pass the entire dynamic expression from the Flow to this step.
In this Example we will create a Simple Calc using Interaction Form so the end User can pick couple numbers and choose what operation he or she would like to do on these numbers.
We start with navigating to a Designer Folder and creating a New Flow.
Next, name the Flow and click Create to continue.
The Flow Designer Opens…
In the Flow Designer’s start-up window under Flows, Rules, Forms and Reports > Forms [Interaction] locate [Pick or Create Form] and click Add to add it to the workspace.
Next, from this step’s Options we click on Pick or Create Form.
We name the Form and click Create to Continue.
The Form Designer opens…
This Form is designed with a Label on top, two Number Boxes to enter Numbers, Dropdown List between them to pick an operation, and an Action Button to Evaluate Calculation.
Next, we save Form and Close it to return back to our Flow Designer.
Connect our Form Step to the Flow’s Start step. Next, under Data > Numbers Category in the Toolbox locate Evaluate Dynamic Expression and drag it to the workspace.
Connect our Form Step outcome to the Evaluate Dynamic Expression Step.
From Evaluate Dynamic Expression Step’s Options choose Show Mapping Editor
In the Mapping Editor choose Text Merge.Plain type of input for the expression value.
Next, click on Show Editor to open Text Merge.Plain Editor.
With the Text Merge Editor open, drag FirstNumber from the Left Pane to the workspace. This [FirstNumber] value refers to the First value that is input by the User in our Form.
Similarly, drag [Operator] and [SecondNumber] to the Merge Text workspace. This completes our Dynamic Expression Builder. Click Ok to save and close Text Merge Editor. As well, we could just use a TextBox in our Form to let the user input the Expression into it and pass the outcome string into our Evaluate Dynamic Expression Step.
Next, in the Mapping Editor we Rename its Outcome to Result. This completes our Mapping so we click Ok to save and close it.
Next we need to create another Form to Display the result of our Calculation. Just like we did with the first form in this Flow we locate [Pick or Create Form] Step under Forms[Interaction] category and drag it to the workspace. We connect this step to our Evaluate Dynamic Expression Step.
From this Step’s Options we choose Pick or Create Form, Name our Result Form and click Create to continue.
Our Result Form is Designed as follow… It has a Title which is a simple Label. It has an Action Button to close the Form. And it has Value Labels from the Flow Data to Display our Calculation.
Next, we save and close our Result Form to get back to our Flow Designer.
We connect our steps and it completes our Flow.
To test the result click Debug Flow link from the top panel of the Flow Designer.
Note that in Decisions version 3.5 and above, you’ll need to click on Test Flow to access the Debugger.
Our First Form opens in the Debugger and we can input some parameters in it.
After we click “Equals” we can see our Result Form with correct answer. Next, click Done to close the Form.
The Diagram shows that our Flow ran with No Errors.