cancel
Showing results for 
Search instead for 
Did you mean: 

Get Non Repeating Records from Collection (Review all Columns)

GabrielaEsquive
Level 3
Hi!

I have this action where i have a collection like this:

35324.png

And expect and ouptut like this: 

35325.png

This is my code stage: 

35326.png
35327.png
35328.png
How can I get it to review all columns to identify repeated records?

Up to now the Output is this:

35329.png

Thanks in advance!
2 REPLIES 2

PvD_SE
Level 12
Hi Gabriela,

I'd suggest to make a new column in the same collection. In the new column you combine all data from the other columns, eg Elena48Red and Miguel28Orange. You will end up getting two rows with Ray58Blue. Then you proceed to remove any rows that are duplicates in the new column. When this is done, you can remove the new column. All of this can be done in BP without the need of a Code stage.

No doubt, someone else will shortly post the code to accomplish the same. 🙂

Happy Coding!
----------------
Paul
Sweden
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

Hi @Gabriela Esquivel,

You can remove the Field Name input parameter and modify your code in the following way:

Dim uniqueRows = (From row In Input_Collection.AsEnumerable()
                  Group row By a = String.Join(", ", row.ItemArray) Into grp = Group
                  Where grp.Count = 1
                  Select grp.First()).ToList()

Output_Collection = uniqueRows.CopyToDataTable()​


This way your grouping would be independent of any specific column and will take all column fields as grouping parameter.

------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant
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.