Hi Sai,
You can use a combination of actions like 'Utility - Strings' and 'Utility - Collection Manipulation' to get the duplicate characters:
I can explain you the working of the workflow here:
1) First, I used the 'Split Text By Lines' action of the 'Utility - Strings' with the following input parameters:
This will give you list of characters in different rows as shown below:
Once, you got this collection we would iterate through this collection using a loop stage. Now create a predefined collection called 'Results' with following schema:
Now, we will check if the current character value in the Split Values collection exists in the Results collection or not using the 'Collection Contains Value' action from 'Utility - Collection Manipulation'. It will return a flag called 'Character Available' which we will check using a decision stage and if the value is True we would skip the current iteration and if the value is False we would proceed ahead. This decision tells us if the Results collection already has that unique character with the occurrence value or not.
If the value of the flag is False, we would set two data items called as 'Current Character' (Text) and 'Occurrence' (Number) with the following calculation stages:
The logic here is pretty simple: for current character we would simply set up the current character row which we are getting from 'Split Values' collection whereas for the occurrence we will use the logic as:
Len(Lower([Test String])) - Len(Replace(Lower([Test String]),[Split Values.Line Text],"")) / Len([Split Values.Line Text])
What it does is let say you have a word called as 'Apple' and we need to get the occurrence of the letter 'p' so we first take the length of the word 'Apple' which is 5 and the we replace the letter 'p' with blank in that word so that the word becomes 'Ale' and then we get the length of the resultant word which is 3. So now we take the difference between the lengths which is 5-3 = 2 and we divide this by the length of the letter which we need to find the occurrence for that is 'p' which will be 1.
Hence, the occurrence is equal to 2/1 = 2 so 'p' occurs 2 times in the word 'Apple'
Now we will simply add the row to 'Results' collection and set up these two calculated values:
So now you will end up with a collection called 'Results ' at the end of the loop stage which looks like this:
Now we can use the 'Filter Collection' action from 'Utility - Collection Manipulation' and use the following filter query:
"[Occurrence] > 1"
Now you will get a collection called 'Filtered Results' with the following values:
So this is basically the letters which are occurring more than one time in our word. Now you can simply iterate through this collection and set up a blank data item of text type called 'Joined Text' with all these letters:
Hence, at the end of the loop stage you will get the result as:
You can refer to the attached process for more details:
------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future
Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website:
https://devneet.github.io/Email: devneetmohanty07@gmail.com
----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.