Tag expression help

I am trying to create a tag with a more complex expression - is anyone able to help? What I want to do is create a tag that follows:
“A directly follows B and directly follows C”

The problem I have is I might have a Case ID that has duplicate Activities and follows the process like: A follows B follows B follows B follows C, so it loops B multiple times. But I want my tag to simply take the unique Activity statuses into account, is there a way to do this expression?

Hello @HMJason!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly

Hi @HMJason,

You could use two expressions in your Tags_preprocessing table to achieve this.

In the first expression (Unique_consecutive_activities_per_case), you can extract only the unique consecutive activities by making a lookup by Case ID in the Events_preprocessing table, setting the level to Case ID, sorting the records level on Event_order, and writing the expression like this:

listtojson(filter(records, prev.Activity <> Activity).Activity)

Afterwards, you can write another expression (A is directly followed by B is directly followed by C) for computing a tag for cases that have activity A directly followed by B and then by C, only looking at unique occurrences of those activities. This would be a per record expression with this logic:

// set variables for activity names for convenience purposes
// you can make these constants in your globals table
var activityA := "a";
var activityB := "b";
var activityC := "c";

// get the list of unique consecutive activities
var activities := jsontolist(Unique_consecutive_activities_per_case);

// calculate the max length of the list of unique activites per record
var maxIndex := count(activities);

// check if A is followed by B
var activityAIsFollowedByB :=
ifnull(indexof(activityB, activities), maxIndex) - ifnull(indexof(activityA, activities), maxIndex) = 1;

// check if B is followed C
var activityBIsFollowedByC :=
ifnull(indexof(activityC, activities), maxIndex) - ifnull(indexof(activityB, activities), maxIndex) = 1;

// finally, combine the two checks
activityAIsFollowedByB and activityBIsFollowedByC

The way this works is that it looks in the list of unique consecutive activities (the first expression you made) and checks that A and B, as well as B and C, are apart from one another by only one index in the list for each case in your data.

Finally, you can add this tag in your Tags_filter as you would with any other tag


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.