Evaluate Dynamic Expression As Rule
  • Updated on 23 Jul 2014
  • 3 minutes to read
  • Print
  • Dark
    Light

Evaluate Dynamic Expression As Rule

  • Print
  • Dark
    Light

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 As Rule Step is unique in the way that it allows end user to pass some values into an expression which makes it dynamic. The other key feature of the output of this step is the Type Boolean .

Example

In this example we will create the flow that let's the user input a number and tells the user if the number is odd or even.
We begin with navigating to the Designer Folder and selecting Create Flow .
CREATE-ACTION-BAR1.jpg

Name the flow and click OK to continue.
2018-06-27_140503.jpg

The Flow Designer opens...
TheEnter Number form was designed for this example.
We locate Enter Number form in flow designer's start-up window under Flows, Rules, Forms and Reports > Forms[Interaction] > [Current Folder] and click Add to add it to the workspace.
2018-06-27_141158.jpg

Enter Number Form is designed as follows... It has a title that is a Label . It has an Action Button to proceed as well. Also, It has a Label and a Number Box for user's input.
2018-06-27_141328.jpg

Under Data > Numbers category locate Evaluate Dynamic Expression As Rule Step and drag it to the workspace. Connect it to the Enter Number form's outcome. Remember that Evaluate Dynamic Expression As Rule Step has two outcome paths because the outcome should be Boolean .
2018-06-27_141635.jpg

From the  Edit Step dialog we select  Merge Plain Text from the inputs action menu. 
Next, we click Show Editor to open Merge Text Editor .
2018-06-27_141712-1.jpg

In the Merge Text Editor we select the plus sign button when hovered over  Number from the Data menu which refers to the user's input. Next we finish our formula that defines if the number is odd or even. In this case, the formula defines if the number is even, so the true outcome path should tell the user that the number is even. We click SAVE to close and save Merge Text Editor.
2018-06-27_142304.jpg

We can click Ok to save and close Mapping Editor and return back to our Flow Designer.
Next we create or drag to the workspace Number Is Odd Form and connect it to the False outcome from Evaluate Dynamic Expression As Rule Step .
2018-06-27_142935-1.jpg

The Number Is Odd Form is designed as follow... It has an Action Button to close the Form and two Labels to inform the User that the number is odd. One of the labels is created from the Flow's Data Value to show the Number that User Input.
2018-06-27_143034.jpg

Next, we drag or create Number Is Even Form to the workspace. This form is designed the same way as Number Is Odd Form . We connect this form to the true outcome from Evaluate Dynamic Expression As Rule Step . Next we can connect all steps as follow.
2018-01-11_105303.png

This completes our Flow. Click Debug Flow link from the top panel of the Flow Designer to test our Flow.
Note that in Decisions version 3.5, you'll need to click the Test Flow link to access the Debugger.

2018-01-11_111104.png

Enter an o dd number in the first form in the debugger and click Check to check it.
2018-06-27_144705.jpg

The Result Form shows us the number we've input and tells us that it is odd. Click Done to close this form.
2018-06-27_144733.jpg

Next, rerun the flow in the debugger by selecting  Create New Session and enter the even number. Click Check to check it.
Result Form shows us the number we've input and tells us that it is even. Click Done to close this form.
2018-06-27_144830.jpg

Was this article helpful?