Creating Expression RuleLast Updated: 05/03/2018 Introduced in Version: 2.0
An Expression Rule allows a user to create a Defined Expression Entity that can be used as a step for a flow with a Boolean outcome. To create one, click on Create Rule in the Designer Folder and pick Create Expression sub menu. After the expression is created, you can locate it in the flow designer in the ToolBox under Integration > Expressions > [UserDefinedCategory] > [UserDefinedNameOfExpression].
In this Example we will create an Expression Rule that will utilize a formula 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 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. Go to Create Rule > Create Expression.
First we enter an 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.
Next provide a Step Category. This will be our defined sub category that can be found under the Expressions category.
Click OK to save and close this Create Expression window.
Next, create a New Flow.
Name the Flow and click OK to open up the flow designer.
The Breaking Distance Form was designed for this example. Locate this form in Flow Designer’s Quick Add 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 follows:
It has a title Label, an Action Button to proceed the form and two Number Boxes for a user to provide the values for distance and speed.
Next, quick add the Expression Rule Step [Braking Distance] under Integration > All Integrations > Expressions > Auto category and add it to the workspace.
Select the Braking Distance step and select Edit Input Mappings.
In the Mapping Editor we map the inputs of Distance and Speed from the form to our expression.
Next we click OK to save and close Mapping Editor.
Drag into the workspace or create the Possible Wreck Form that will be used to 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 add our Successful Braking Form that informs a user that they will be able to successfully brake under the current speed and braking variables. We connect this form to the True outcome and connect the other steps as displayed below. This completes our Flow.
To test our flow we click the Debug Flow link at the top panel of the Flow Designer.
Run the flow the first time with fairly close distance to the object input.
And we see that the Possible Wreck Form informs us that it is possible to wreck.
Run the flow a second time with the same speed but longer distance.
The Successful Breaking Form appears as a result.
After we click Done we can see a diagram that shows us that our flow ran without any errors.