Examples
Step-by-Step Usage Examples
Below you will find step-by-step examples that illustrate the typical use of the SUCCESSOR and PREDECESSOR operators. For these examples, imagine a single case with a list of activities in ascending order of occurrence, for example [A, B, C, D, E, ...].
Example 1
Forward Iteration, Single Step
SUCCESSOR("_ARIS.Activity"."Activity name")
Moves one step forward.
If the current (origin) activity is A, the result is B.
If the origin is the final activity, returns NULL unless a fallback is specified.
Example 2
Forward Iteration, Two Steps
SUCCESSOR("_ARIS.Activity"."Activity name", steps:2)
Skips one matching activity and returns the second one.
If [A, B, C, D] are in a case and you are on A, you get C (assuming no filter).
Example 3
Forward Iteration with a Filter
SUCCESSOR("_ARIS.Activity"."Activity name", filter: "_ARIS.Activity"."Activity cost" > 300)
Moves forward through the list of activities, skipping those whose "_ARIS.Activity"."Activity cost" is <= 300.
Returns the first encountered activity with "_ARIS.Activity"."Activity cost" > 300. If none is found, the calculation is aborted with NULL.
Example 4
Forward Iteration with LAST
SUCCESSOR("_ARIS.Activity"."Activity name", steps:LAST)
Finds all forward activities that (optionally) pass a filter, then returns the final match.
If no filter is given and the list is [A, B, C, D], from A you get D.
Example 5
Forward Iteration with Fallback
SUCCESSOR("_ARIS.Activity"."Activity name", steps:2, fallback: 'noMatch')
If you cannot find a second next activity, returns 'noMatch' instead of aborting the calculation with NULL.
Example 6
Backward Iteration, Single Step
PREDECESSOR("_ARIS.Activity"."Activity name")
Moves one step backward.
If the origin is C, you get B.
If the origin is the first activity, the calculation is aborted with NULL as the final result.
Example 7
Backward Iteration with Filter, Steps, and Fallback
PREDECESSOR( "_ARIS.Activity"."Activity name", filter: "_ARIS.Activity"."Activity type" = 'USER_TASK', steps: 2, fallback: 'NoPrevMatch' )
Looks backward for activities with type = 'USER_TASK'.
Returns the second one you find. Otherwise, 'NoPrevMatch'.
Example 8
Using ORIGIN in Filters (Simple Equals Only)
SUCCESSOR(
"_ARIS.Activity"."Activity name",
filter: ORIGIN("_ARIS.Activity"."Activity type") = "_ARIS.Activity"."Activity type"
)
Only considers activities with the same type as the origin.
Complies with the rules: simple equals, ORIGIN on one side, and a regular field on the other.
Example 9
Nested Usage of SUCCESSOR/PREDECESSOR
SUCCESSOR(
CONCAT("_ARIS.Activity"."Activity name", '-', SUCCESSOR(
"_ARIS.Activity"."Activity name"
))
)
The inner SUCCESSOR obtains the name of the next activity; CONCAT merges it with the current activity’s name.
The outer SUCCESSOR then moves forward again from the origin to retrieve a second “next” result.
If the origin is C, you get D-E.
Because there are at least two SUCCESSOR calls, this qualifies as a “nested iteration.”
Example 10
Dynamic Steps
SUCCESSOR( "_ARIS.Activity"."Activity name", steps: "_ARIS.Activity"."Dynamic step count" )
Uses a field "_ARIS.Activity"."Dynamic step count" in the origin activity to decide how many forward steps to move.
Combine with fallback if needed:
SUCCESSOR( "_ARIS.Activity"."Activity name", steps: "_ARIS.Activity"."Dynamic step count", fallback: 'NoStep' )
Other examples
Example 11
Forward Iteration with Condition and Concatenation
CONCAT( "_ARIS.Activity"."Activity name", SUCCESSOR( "_ARIS.Activity"."Activity name", filter: "_ARIS.Activity"."Activity cost" > 300 ) )
Results in [currentActivityName][the next activity with cost > 300].
If no such next activity, the complete calculation returns NULL.
Example 12
Backward Iteration with Complex Named Parameter Ordering
PREDECESSOR( "_ARIS.Activity"."Activity name", fallback: 'NoPrev', steps: 2, filter: "_ARIS.Activity"."Activity type" = 'X' )
Skips backward until it finds two matching activities of type 'X'.
If it cannot find two, returns 'NoPrev'.
Example 13
Nested Usage Comparing Origin Fields
SUCCESSOR(
CONCAT(
ORIGIN("_ARIS.Activity"."Activity name"),
'-',
"_ARIS.Activity"."Activity name"
),
filter: ORIGIN("_ARIS.Activity"."Activity cost") = "_ARIS.Activity"."Activity cost",
steps: LAST
)
Only returns the final forward activity that has the same "_ARIS.Activity"."Activity cost" as the origin.
Combines referencing origin fields in the filter with a nested expression in CONCAT.