Creating Expression RuleLast Updated: 07/20/2016 Introduced in Verision: 2.0 |
Expression Rule allows User to create a Defined Expression Entity which could be used as a Step for the Flow with Boolean outcome. To create one the User should click on Create Rule in the Designer Folder and pick Create Expression submenu. After Expression is created it is found in the Flow Designer in the ToolBox under Integration > Expressions > [UserDefinedCategory] > [UserDefinedNameOfExpression]
Example
In this Example we will create the Expression Rule that will have a formula in it to calculate Vehicle’s Breaking Distance to the Object.
Next we will create a Flow that will ask a User for the Current Speed and for the Distance to the Stop Point. Next it will tell the User if this Distance is enough for the Current Speed to Stop before the Desired Stop Point.
We begin with navigating to the Designer Folder, Clicking Create New Rule and choosing Create Expression from its submenu.
Edit Defined Expression Entity pop-up opens. First we enter Expression Name (This will be the name of our step in the Flow Designer).
In the Expression window we enter our Expression. The values in square braces are the variables.
Finally, in StepCategory we Enter our desirable Category. (This will be our defined subcategory that will be found under Expressions Category)
Click Ok to Save and close this Expression Setup window.
Next, create a New Flow.
Name the Flow and click Create to continue.
Flow Designer opens. Breaking Distance Form was designed for this example. Locate this form in Flow Designer’s start-up window under Flows, Rules, Forms and Reports > Forms[Interaction] > [Current Folder] category. Select it and click Add to add it to the workspace.
Breaking Distance Form is designed as follow…
It has a title Label, an Action Button to proceed the form and two Number Boxes for User to input Distance and Speed.
Next, locate our Expression Rule Step [Breaking Distance] under Integration > Expressions > Auto category and drag it to the workspace.
Connect it to our Form’s outcome and choose Show Mapping Editor from its Options Menu.
In the Mapping Editor we map User’s inputs of Distance and Speed from the Form to our Expression.
Next we click Ok to save and close Mapping Editor.
Next, we drag or create the Wreck Form which will tell the User that it is dangerous and possible to wreck because the breaking distance is more than the distance to the desirable stop point.
We connect this form to the False outcome from our Expression Rule Step.
Next, we create or drag the Successful Breaking form which is similar to the Wreck Form but it informs User that it is possible to stop before the desirable stop point under the conditions of current speed. We connect this form to the True outcome and connect the other steps as follow. This completes our Flow.
To test our flow we click Debug Flow link on 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.
Run the Flow the first time with fairly close distance to the object input.
And we see that Danger Form informs us that it is possible to wreck.
Run the Flow second time with the same speed input but longer distance…
Successful Breaking Form appears as a result.
After we click Done we can see a diagram that shows us that our Flow ran with no Errors.