Decision

The decision node is a very powerfull node that can be used to model bussiness rules in your application. In the decision node a certain condition is specified by using the WEM expression builder. When a flowchart reaches the decision node, the condition is evaluated and based on the outcome (the exit) the flowchart will take a certain route.

Properties

The properties pane of the decision node has only 2 elements: The Expression and a list of the available exits. Therefore it is easy to overlook the versatility of the decision node.

In the expression field it is possible to create incredibly complex statements combining multiple different expressions (like If Then Else, Choose, AND, OR). Allowing the evaluation of complex business rules.

Exits

Decision nodes have several exits, based on what the decision node needs to evaluate. Most people will only use a decision node which evaluates to True or False. However WEM also allowes decision nodes that evaluates to all other Data types. If the Data Type that the decision node returns is Text, Concept or Number, a button appears that allows you to create multiple exits. This opens a lot of possibilities. Some examples are given further down this chapter.

In the table below the most common exits are listed. Not all exits are available for every Data Type.

Exit

Description

Default exit

When none of the other exits apply, this is the exit that is used. The Default exit is always available.

Unknown value

This is the exit when the condition returns no value. This exit is always available.

HasValue

This is the exit van the data field contains a value. This exit is available for a limited set of Data types.

Yes

This is the exit when the condition evaluates to ‘true’. This exit is only available when the return Data Type is boolean.

No

This is the exit when the condition evaluates to ‘false’. This exit is only available when the return Data Type is boolean.

Default exit

Users have a tendency to only choose the exits that apply in the scenarios they expect. For example in a decision node with a boolean Data type only the Yes and No exits are used. Therefore the default exit is often times overlooked. In reality there are often edge cases that cause an error because the none of the exits used is suitable. Therefore it is advisory to always use the Default exit.

In the example below a decision node is used to evaluate if the user role of the current user is equal to administrator. If Yes then the user should be guided to an administrator screen. If No then the user needs to be guided to the main screen. In this scenario using the Yes and No exit would probably work just fine. But maybe a situation can arise where the expression can't be evaluated. In that case the user would see an error. To prevent that it is better to use the "Default exit" exit instead of the "No" exit.

[Authentication.Session.Refcurrentuser] -> [Authentication.Users.Role] = 'Role'.'Admin'

Last updated