How to skip the duplicate rows by selecting only its first occurance?


I Have a datatable shown below


row1: 1234
row2: 1234
row3: 1234
row4: 7895
row5: 7895

Here, i need to select only the row of first occurance of Candidate number and fetch the entire row, then jump to the next unique candidate number…

for example, Candidateno = 1234, which is repeated 3 times but i need to fetch only Row1 and then jump to next Candidateno =7895,which is row4, so on

Can any1 help me with this?

In Case of the datatable inly have 1 datacolumn following Statement can be Used as Well

Yourdatatablevar.defaultview.totable(true, {“yourcolumnname”})

HI @ppr

I have many columns corresponding to unique candidateno,

I dont want to copy the result to new table, i mean i dont need a new table, i just want to find the indexof first occurance of the Unique id and then move to next unique id in a for each row…

Why does it matter if you use a new datatable with the duplicate rows removed, or if you use the existing datatable and skip duplicate rows? The end result is exactly the same, but it’s much easier programmatically to just create a new datatable variable than it is to code something that skips over rows on your existing table. New datatable is quicker to code, easier to read/understand, and will be faster to process

1 Like

Just use a for each row loop, capture the value of the index in a variable, and use an if statement that compares the current index to the variable; if they are equal then X else Y

Hi @Vinodraj_N

You can try this (39.4 KB)

Hope it helps


Nived N

Happy Automation

1 Like


Thanks Your Replay, I also tried the lookup datatable but got stuck…

You provided me Exactly what i was Expecting.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.