Evaluate Dynamic Expression

Last 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.

 

Example

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.

createFlow

Next, name the Flow and click Create to continue.

nameFlow

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.

flowStarts

 

Next, from this step’s Options we click on Pick or Create Form.

pickOrCreate

 

We name the Form and click Create to Continue.

nameForm

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.

formDesigned

Next, we save Form and Close it to return back to our Flow Designer.

saveForm

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.

dragEvalDynamicExpression

Connect our Form Step outcome to the Evaluate Dynamic Expression Step.

connectToEval

From Evaluate Dynamic Expression Step’s Options choose Show Mapping Editor

showMappingEditorEval

In the Mapping Editor choose Text Merge.Plain type of input for the expression value.

textMergePlain

Next, click on Show Editor to open Text Merge.Plain Editor.

showEditor

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.

dragFirstNumber

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.

finishBuildingExpression

Next, in the Mapping Editor we Rename its Outcome to Result. This completes our Mapping so we click Ok to save and close it.

renameOutputAsResult

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.

dragAndConnectAnotherPickOrCreateForm

From this Step’s Options we choose Pick or Create Form, Name our Result Form and click Create to continue.

nameResultForm

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.

resultFormDesign

Next, we save and close our Result Form to get back to our Flow Designer.

We connect our steps and it completes our Flow.

connectAllSteps

To test the result click Debug Flow link from the top panel of the Flow Designer.

debugFlow

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

3.5 Test Flow Shot

Our First Form opens in the Debugger and we can input some parameters in it.

debugRunningFirstForm

After we click “Equals” we can see our Result Form with correct answer. Next, click Done to close the Form.

result

The Diagram shows that our Flow ran with No Errors. 

debugWithNoIssues

Additional Resources