How to get duplicate rows?

Hi,

I want to know how can i get the duplicate rows in excel and paste them to some other excel sheet??

Thanks in advance.

1 Like

Hi @SHAISTA,
YOU CAN USE select query for get unique data and use for each row activity for looping . if the value of for each data is appeared more than 1 time u can get that data and put into the another excel file.

Regards
P.Ajith

Yes i know that, but i am not able to understand what should be the condition.

I know one function . It will copy only the unique values

@SHAISTA
Do you want the rows which are repeated more than once right.

Regards,
Mahesh

@MAHESH1 Yes exactly

No thanx. I know that function.
I have already applied it earlier.

@SHAISTA

Try this Query

(From p in dt.Select()
where( From q in dt.Select()
where string.Join(“,”,q.ItemArray).Equals(string.Join(“,”,p.ItemArray)
Select q).ToArray.Count>1
Select p).ToArray.CopyToDataTable

Regards,
Mahesh

This is to be used in assign function na??

@SHAISTA
Yes

Regards,
Mahesh

@SHAISTA

You have to replace dt with your datatable Variable and assign the result to one more datatable variable**

(From p in dt.Select()
where( From q in dt.Select()
where string.Join(“,”,q.ItemArray).Equals(string.Join(“,”,p.ItemArray))
Select q).ToArray.Count>1
Select p).ToArray.CopyToDataTable

Regards
Mahesh

2 Likes

@MAHESH1 i am getting this error- Assign : The source contains no DataRows.

@SHAISTA, Hope you haven’t read the excel! This means your datatable hasn’t been assigned with values.

Regards,
Dom :slight_smile:

@MAHESH1 @Dominic Yeah thanx.Actually i was searching in the wrong file.
It worked.Thanks :slight_smile:

This isnt working for me and keeps throwing out this error “object reference not set to an instance of an object”. Any help will be greatly appreciated please,

There is some variable in the assign activity which is not initialized properly.Use debug and check for the variable.