Hi Sandeep,
This seems like a fun logic puzzle where I'm sure there are about a thousand different ways to do it. The one I see at first which seems to be reliable would be something like this:
--Create a new collection (for this example I'll call it "unique values")
--Create a new flag data item (for this example I'll call it "prior match"). Default to FALSE
1. Sort the original collection (make sure you accept the Success and Message output and check that the sort is successful - sometimes it isn't, and if sorting on a date time field it doesn't seem to return the results I would expect)
2. Get the value in row 1 and store in a separate data item (for this example, I'll call it "compare point")
3. loop the original collection (so now you can retrieve the data in row 2)
Inside the loop your logic would be something like this:
4. Compare your value in row 2 to "compare point". Use a Choice stage for clarity
4a. If the value does not match the "compare point" AND your "prior match" flag is FALSE, add the value in your "compare point" to your "unique values" collection. (you've confirmed that it doesn't match the value before or after it in the sorted collection, so it must be unique. Update the "compare point" to be the value from the "original collection"
4b. If it does not match and your "prior match" flag is TRUE, update your "compare point" to the new value in your original collection (you've checked the prior value against all values in the original collection that could match, because it's sorted). ALSO update your "prior match" flag to FALSE (because now you're looking at a new value that hasn't been compared yet). DO NOT Add this value to your "unique values" collection because it matched at least one other item in the original collection.
4c. If it does match, set the set the "prior match" flag to TRUE. Do not add to unique values and do not update the compare point
5. Loop the original collection and repeat
I hope this makes sense and isn't too convoluted. Like I said to start, there are a ton of ways to do this and I'm sure someone will have a nice code stage you could use. This was my first thought at something that uses only Blue Prism functions. Also it's possible I missed updating one of the data items somewhere in my description (I wrote it out without testing the flow in a process page) so you'll definitely want to test all the possible options for matching and not matching to make sure the flow is accurate.
Good luck!
------------------------------
Diane Sanzone
------------------------------