Hi Sai,
You can use a combination of actions like 'Utility - Strings' and 'Utility - Collection Manipulation' to get the duplicate characters:
![12207.png 12207.png](/t5/image/serverpage/image-id/12376i6E483F2AB54D0286/image-size/large?v=v2&px=999)
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:
![12208.png 12208.png](/t5/image/serverpage/image-id/12378i7E5488E3A55B1C37/image-size/large?v=v2&px=999)
This will give you list of characters in different rows as shown below:
![12209.png 12209.png](/t5/image/serverpage/image-id/12377i5B6772952206465F/image-size/large?v=v2&px=999)
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:
![12211.png 12211.png](/t5/image/serverpage/image-id/12380iC013D908BC4E4D82/image-size/large?v=v2&px=999)
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.
![12212.png 12212.png](/t5/image/serverpage/image-id/12383i61BD913D989A5C3F/image-size/large?v=v2&px=999)
![12213.png 12213.png](/t5/image/serverpage/image-id/12381iAE004DB62660F9DB/image-size/large?v=v2&px=999)
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:
![12214.png 12214.png](/t5/image/serverpage/image-id/12384i07A4A36A81BF88F4/image-size/large?v=v2&px=999)
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:
![12215.png 12215.png](/t5/image/serverpage/image-id/12382i44E33CBC1E153B6D/image-size/large?v=v2&px=999)
![12216.png 12216.png](/t5/image/serverpage/image-id/12385i838C20CB0508608B/image-size/large?v=v2&px=999)
So now you will end up with a collection called 'Results ' at the end of the loop stage which looks like this:
![12217.png 12217.png](/t5/image/serverpage/image-id/12386iE23A36BC8C8E212B/image-size/large?v=v2&px=999)
Now we can use the 'Filter Collection' action from 'Utility - Collection Manipulation' and use the following filter query:
"[Occurrence] > 1"
![12218.png 12218.png](/t5/image/serverpage/image-id/12388iB080C47426B9D259/image-size/large?v=v2&px=999)
Now you will get a collection called 'Filtered Results' with the following values:
![12219.png 12219.png](/t5/image/serverpage/image-id/12387i1402F411BBF92D8B/image-size/large?v=v2&px=999)
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:
![12220.png 12220.png](/t5/image/serverpage/image-id/12389iBB5CA3B088737614/image-size/large?v=v2&px=999)
![12221.png 12221.png](/t5/image/serverpage/image-id/12390iA5D16C59EEFDE979/image-size/large?v=v2&px=999)
Hence, at the end of the loop stage you will get the result as:
![12222.png 12222.png](/t5/image/serverpage/image-id/12391i6FC5EEBD3A387403/image-size/large?v=v2&px=999)
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.