How to use pathing conditions
1. What You Will Learn
After finishing this tutorial you will be able to use pathing conditions correctly and to properly incorporate them
into your PAK workflows in the Editor.
2. Prerequisites
To complete this guide you need:
-
Roughly 10 minutes
-
Installed PAK Editor.
-
Installed PAK Workflow Executor
This HowTo does not contain a detailed introduction to the editor. Click here to learn everything about the PAK workflow Editor. |
3. What are pathing conditions
After an exclusive or inclusive gateway, there is usually more than one possible path to take.
It usually depends on a condition, which of the paths should be used during execution.
These conditions will be added to the outgoing edges of the gateway.
For Example: We want to ask the user a simple question, but depending on their answer we have to take different paths of execution.
In our example we just want to write the users answer into the Datastore.
Any condition added to an edge, that is not rooted at an exclusive or inclusive gateway will be ignored! |
If a gateway is encountered and you have a case, which is not part of any condition of the outgoing paths, the workflow will fail. For example, you have a path that will test if a number is greater than 5, and a path where you test if it is less than 5. If the number is equal to 5, the workflow will fail with the exception, that no follow-up node is defined for that gateway. Therefore, to ensure a fail-safe workflow, you will have to make sure, to cover all possible scenarios of a gateway. |
4. Conditions
The expressions are parsed and processed from left to right. |
4.1. Basic Logic
Allowed Operations | Description |
---|---|
== |
equals |
!= |
not equals |
> |
greater than |
>= |
greater or equals |
< |
less than |
<= |
less or equals |
&& |
AND (i.e. (true && false) ⇒ false) |
|| |
OR (i.e. (true || false) ⇒ true) |
! |
negation operator, not |
? |
exists-check for |
Logical operations should be inside of braces. |
4.2. Interpolation
Interpolation can be used in conditions.
The optional expression („?“) is not compatible with interpolation.
Multiple interpolations are usable in strings while a single interpolation can be used like a variable.
Syntax | Description |
---|---|
|
to pass the value of the field |
|
to pass the value of the property |
|
to pass the value of a java based system property |
|
to pass the value of a environment variable of your system |
You can find a more detailed guide on interpolation here! |
4.3. Examples
Example | Meaning |
---|---|
${keyOrOutputField} == someValue |
the value behind the interpolation is equal to someValue |
(a < 5 ) && !b |
a is less than 5 AND NOT b |
a==5 |
a is equal to 5 |
(!(x <= 6) && (x > 9)) || (y!=8) |
(NOT (x less or equal 6) AND (x greater than 9)) OR (y NOT Equals 8) |
someString == x |
x has the value of someString |
y != anotherString |
y has not the value anotherString |
a? || b? |
is a available OR is b available |
a? && a == „someString“ |
is a available AND then check if it is equal to the value of „someString“ |
5. In the BPMN Editor
Using the introduction example, we will build a simple workflow that will, depending on the users input, write one or the other value into the Datastore.
-
Add an exclusive or inclusive gateway from the workflow controls to your workflow.
Continue by adding the rest of the workflow with multiple paths from the gateways.Figure 2. gateways with conditions on outgoing pathsFigure 3. workflow before adding conditions -
After the paths from the exclusive/inclusive gateway were added you can assign conditions to them.
By clicking on the corresponding edge, a condition can be added to the corresponding Properties field.
TheName
-Property enables the user to label edges.
IfName
remains empty, the edges will have no description, and you have to click on the edge to see its condition.Figure 4. Properties of the edgeFigure 5. Finished workflow -
This is what the execution and the datastore would look like, if the user chose „yes“.
A guide, on how to run a workflow in the executor can be found here! |