How to get duplicate rows?

excel
uiautomation
activities
studio
duplicates

#1

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.


Duplicate rows in data table
#2

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


#3

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


#4

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


#5

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

Regards,
Mahesh


#6

@MAHESH1 Yes exactly


#7

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


#8

@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


#9

This is to be used in assign function na??


#10

@SHAISTA
Yes

Regards,
Mahesh


#12

@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


#13

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


#14

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

Regards,
Dom :slight_smile:


#15

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


#16

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,


#17

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