How to Delete Duplicate Rows in a Collection

Pablo_Sanchez

New Member
Hi guys, this is my first post and I'm new at Blueprism (usually I worked with UiPath but need to change)

I'm actually stuck at one point. I need to delete duplicate rows in a Collection. If someone could give me some sample code or any help I would be really grateful.
1528976888032.png
Thank you guys, I'll be waiting some response.
Bests,
Pablo
 

Pablo_Sanchez

New Member
Hi Sukesh,

Thank you for your fast reply. I have followed the sample but I'm not able to do it because I have a collection with 2 columns, and I have to check if the first column has duplicate codes -> delete the whole row

1528984640345.png 1528984732816.png

Maybe its easy to do following the sample but I couldn't... sorry... Could I have a little bit more help ?

Bests,
Pablo
 

Attachments

  • 1528984707203.png
    1528984707203.png
    5.4 KB · Views: 44

Sukesh Kumaru

Active Member
Hi Pablo_Sanchez,

I think you should go for using CODE stage and add VB Script code for deleting duplicate rows from collection then you can achieve your desired results.

Regards,
Sukesh.
 

VJR

Well-Known Member
Hi Pablo_Sanchez,

You will need to use Post #2 in the same link for deleting the dupes in the column.
Use the same diagram. Just instead of Column 2 in that post, use name of Column 1 in your diagram because that is what you want the duplicates to be checked on. And instead of copying only 1 column to the destination collection, use a Multi Calc stage (or two Calc stages) and copy both the columns.
When 'If Found' is No only then we are copying both the columns to Destination collection then that means that an entire row is not copied (deleted) to the destination collection when 'Found' so you don't need to worry much about deleting an entire row.
If you post back where have you reached till now in your process diagram and where are you having difficulties I could assist you further on that.
 

Prit

New Member
This can be done by a simple code stage.
INPUT: Collection_In (as Collection)
OUTPUT: Collection_Out (as Collection)
CODE: Collection_Out = Collection_In.DefaultView.ToTable(True)
Good Luck!
 
Top