How to find duplicates of rows

Hi,

I have the table with purchase invoices. I would like check if the same invoice was not entered twice. If in my data table I find three variables the same (contractor, no of invoice and amount), I will assign it.

How to do it?

1 Like

so you want to delete the entire row if the same invoices is repeated??
@Krzysztof

No, I have to send information to the person, who is responsible for it. I would like to assign this information to variable.

1 Like

so if there is a duplicate invoice,then you have to trigger a mail or smthg like that??

you can go through this post!
Cheers

1 Like

Could you make example to my data table?Invoices.xlsx (15.8 KB)

Hi @Krzysztof,

Use following code in assign activity to get duplicate records,

DuplicateDT =

(From p In DT.Select() 
Group p By dupli = New With {Key .contractor = CStr(p("Contractor")), Key .invoice = CInt(p("Invoice no")), Key .amt = CInt(p("Amount"))} Into Group 
Select Group(1)).ToArray.CopyToDataTable()

In this, I applied groupBy on last 3 columns (As you want to consider record as duplicate when values of last 3 columns are same) and get 1st index group value (Group(1) it’s 2nd occurence) because we have to fetch record with at least 1 duplication.

Here I’m attaching workflow for your better understanding. β€”> Duplicate.zip (27.8 KB)