cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Delete a certain part of a string variable and filter duplicated data

Jump to solution

Hi everyone,

Question 1:

I have this problem that when I store a data in a variable there is a extra letters that I want to delete for example if I use a default string as an output it will show this:

i:0#.w|emrsn\rogelio.tan

and when I use display name as an output it will show

Tan, Rogelio [CORP/PH]

what I want to happen is either delete the i:0#.w|emrsn or [CORP/PH]

Also, I'm using a People/Group variable.

Question 2:

Those People/Group mention above will be stored in a build string action and is there a way to filter those variable because if there is a duplicate of name I don't want it to be stored in the string so every name stored in the string will be unique and no duplication occurs is there a way to do this?

The current result of my workflow is like this: Tan, Rogelio [CORP/PH], Tan, Rogelio [CORP/PH], Buena, Melissa [CORP/PH], DL CORP EOC.

My desired result is like this Tan, Rogelio [CORP/PH], Buena, Melissa [CORP/PH], DL CORP EOC.

The reason why there is a duplication because several items has the same Owner and I loop through all the items created that's why when I store the value in the string it will go through each item and store all the Owner of the items.

Labels: (2)
0 Kudos
Reply
9 Replies
Workflow Hero

Re: Delete a certain part of a string variable and filter duplicated data

Jump to solution

For question 1 regular expression action is your friend here.

If you have Tan, Rogelio [CORP/PH] you can use this regular expression to make it to Tan, Rogelio.

 \[.*?\]

Your action would need to look like this:

For question two I could think of the following. You could have a condition in your loop which is already adding the names to your string (as I assume).

So if your people string not contains Rogelio, Tan you can add it, otherwise you would skip it.

What do you think?

Reply
Workflow Hero

Re: Delete a certain part of a string variable and filter duplicated data

Jump to solution

Hi Enrico,

I'll try all of this and get back to you after I got my desired results.

Thank you!

Reply
Workflow Hero

Re: Delete a certain part of a string variable and filter duplicated data

Jump to solution

Hi Enrico,

I successfully delete the [Corp/ph] but I still can't get my desired result in deleting the duplicates. I search for a similar problem with me in the forum and I saw that some of them use Collection action(Remove Duplicates). Here is my workflow and I still can't make it work. Maybe you can shed some light to this.

First is I calculated the date for the reason of querying for a specific date span.

Then I query using the variable StartDate which is set to Today and the EndDate that used in calculate date. I stored the results in a collection variable CollectionID1

Then I use a Collection Operation which says Remove Duplicates is collection ID1 and store in CollectionID2

Then I use a For Each action to loop and store the values in a variable. (I expect here that it will only store unique values because the duplicate was deleted in the Collection Operation)

Here is how I set the variables.

But still after I receive the notification the output still has duplicates. I wish my presentation is clear enough. If you have any question from my workflow feel free to ask. Thanks a lot.

Reply
Workflow Hero

Re: Delete a certain part of a string variable and filter duplicated data

Jump to solution

Hmm, I'm not sure how you iterate the users but what you could do is adding the name you used in the regular expression to a collection.

After you added all names (with duplicates) to your collection, you use the remove duplicate function of the collection. But it only works with real duplicates / identical strings.

So the result could be something like this:

Reply
Workflow Hero

Re: Delete a certain part of a string variable and filter duplicated data

Jump to solution

Hi Enrico,

I'm Really sorry if I suggested the Collection Operation because I thought I could make it work but it seems that Run If Action is a much better option.

It seems that to remove the duplicate from my workflow is a lot complicated. There is a two input in this workflow Change Coordinator and Distribution. There is a chance that the user will input the same people in those fields which is for example Tan, Rogelio for both Change Coordinator and Distribution. What I did to avoid duplication in this is a Run If action which will run if those two input is the same and only getting the value of Change Coordinator.

So if Change Coordinator = Distribution.

Store the Change Coordinator.

If Change Coordinator ! = Distribution

Store both Change Coordinator and Distribution.

In this way I avoid duplication of data.

But what if in the second loop there is a duplication from the first loop. Is there a way to store this values on a separate variable that will only stack altogether. so there is something I can compare my current values.

0 Kudos
Reply
Workflow Hero

Re: Delete a certain part of a string variable and filter duplicated data

Jump to solution

So you found a solution on your own?

0 Kudos
Reply
Workflow Hero

Re: Delete a certain part of a string variable and filter duplicated data

Jump to solution

Hi Enrico,

Yes. Thanks a lot for your help and suggestion.

Cheers,

Rogelio

Reply
Workflow Hero

Re: Delete a certain part of a string variable and filter duplicated data

Jump to solution

Can you post your solution so that we can close out this thread?

Reply
Workflow Hero

Re: Delete a certain part of a string variable and filter duplicated data

Jump to solution

Hi Cassy,

Here is the solution. This is a different one from the one I replied earlier with enrico I just simplified it

Variables Used:

Today (Set to the current date) [Date and Time]

EndDate (Set as blank) [Date and Time]

CollectionID (For storing the queried items) [Collection]

EventID [List Item]

Change Coordinator [People and Group]

Distribution [People and Group]

Dup_CC (For storing the filtered items) [Single Line Text]

Here is the first part of the workflow for querying.

Here is where I filtered the duplicated items in my list.

Make a condition where the Dup_CC (variable that will store Change Coordinator) does not contain Change Coordinator.

In the Build String action Insert the Dup_CC itself so that It can be called again when the loop goes on and also, insert the Change Coordinator.

This Run If action is the same as the first run if. If Dup_CC does not contain Distribution it will run.

In this Build String action store it again in the Dup_CC and Insert reference Dup_CC so that the previous values will not be lost for the following loop then insert distribution

I hope I explained clear.

Reply