Detect loops followed by a specific activity

Hello to everyone who reads this!

I think the solution of my problem could be pretty easy, but I dont get it…

I need to search for loops of each activity in my analysis which are directly followed by an specific activity.
Every activity can loop and every activity can be directly followed by the specific activity.

Basically the soltion should be something like this:
FILTER MATCH_PROCESS_REGEX (“Table1”.“ACTIVITY”, ‘variable’ >> ‘variable’+ >> ‘XXX’ $ ) = 1
An activity (no matter if it is the first activity in the case or not) is followed by one or more occurrences of the same activity and is directly leading to the specific activity XXX.

Yes: A - A - XXX
Yes: A - A - XXX
Yes: A - B - C - C - C - C - XXX
Yes: V - W - P - P - P - XXX
No: D - D - E - XXX
No: F - G - F - G - XXX

My problem is, I dont know how to insert a variable or something similar into this formula which is checking each activity in the analysis not only the “hard coded” one.

It would be great to see the number of occurrences of each specific process flows that applies.
Using the example from above:
A - A - XXX = 2
A - B - C - C - C - C - XXX = 1
V - W - P - P - P - XXX = 1

Thanks for your help!

3 Likes

I forgot to mention:
I am working on 4.5

1 Like

Hello Michael,

in the IBC and the upcoming CPM4.6, you can use INDEX_ACTIVITY_LOOP and ACTIVITY_LEAD to find cases where such a pattern occurs:

FILTER PU_COUNT ( "Cases", 
"Activities"."ACTIVITY", INDEX_ACTIVITY_LOOP  ( "Activities"."ACTIVITY" ) > 1 
AND ACTIVITY_LEAD ( "Table1"."ACTIVITY" ) = 'XXX 
) > 0;

On CPM4.5, I think there is no way to do this unfortunately :frowning:
What should be possible on CPM4.5 would be to find cases where activity XXX happens after another activity was executed multiple times, but possibly with other activities in between, like

A-B-A-XXX

(A directly before XXX, and this A is already the second occurrence in the case). If I understand you correctly, however, this is not what you wanted to have, right?

Best
David

1 Like

Hi David,
Thank you for your detailed answer.
Is this functionality already implemented in the IBC or is it also “upcoming”?

How would you handle the topic on CPM 4.5?
Maybe I can derive results from that as well…
I tried to solve this issue with “variant”, but without success.

Thanks and kind regards,
Michael

Hi Michael,

in the IBC, this already works.

The closest I could get in CPM4.5 would be this:

FILTER TARGET( "Activities"."ACTIVITY" ) = 'XXX' 
AND SOURCE ( ACTIVATION_COUNT ("Activities"."ACTIVITY") ) > 1;

ACTIVATION_COUNT indexes activities of a case based on the number of times each activity already occurred in that case. So what we can do is, we can say we want to show cases where the target activity is XXX, and the activity before that (the source activity) has an ACTIVATION_COUNT of > 1 (which means that this activity already occurred at least twice in the case).

Best
David

He David,

Better late than never :slight_smile:, but I finished this just a few minutes ago.
I used your approch and added a few things:

FILTER TARGET( “Activities”.“ACTIVITY”) = ‘XXX’
AND SOURCE ( ACTIVATION_COUNT (“Activities”.“ACTIVITY”) ) > 1
AND PROCESS EQUALS ‘<%= Loop_Variable %>’ TO ‘<%= Loop_Variable%>’ TO ‘XXX’

With the additional “Process Equals” line, in combination with a button dropdown I can select single Activities and view them in my different analysis as I wanted in the first place. Just not perfectly convenient…

As always, thanks David! Really appreciate your support,

Cheers,
Michael