Evaluate Dynamic Expression As Rule
- Updated on 23 Jul 2014
- 3 minutes to read
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 .
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 .
Name the flow and click OK to continue.
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.
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.
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 .
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 .
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.
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 .
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.
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.
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.
Enter an o dd number in the first form in the debugger and click Check to check it.
The Result Form shows us the number we've input and tells us that it is odd. Click Done to close this form.
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.