How to delete entire row by reference of particular column duplicated values

Hi

iam trying to delete entire rows by reference of Column name “issueId” duplicate values
Table

i tried with remove duplicate rows activity but it not work
output expected to be like this
Expected table

Thanks in advance

Hi @jai_kumar2

How are you expecting your output?

Thanks for your reply
i mentioned

1 Like

Hi,

Can you try the following expression?

dt = dt.AsEnumerable.GroupBy(Function(r) r("issueId").ToString).Select(Function(g) g.Last()).CopyToDataTable()

Regards,

Hi @jai_kumar2
Duplicate data is unavoidable and it is not always possible to keep it away.

Sometimes it can be also that we are trying to get distinct values.
So how we do that?

We can use the below LINQ query to achieve it

dataTable new_dt =
old_dt.AsEnumerable().GroupBy(Function(i) i.Field(Of String)(“columnWithDuplic”)).Select(Function(g) g.First).CopyToDataTable

Note:
1.Useful when we are removing duplicates with respect to some “Column” name
2.Simply replace the “columnWithDuplic” with your required column name

OR

We can use the simple DefaultView Code too…

dataTable new_dt =
old_dt.DefaultView.ToTable(True)

Note:
Useful when we are removing duplicates with respect to every “Column”

1 Like

Hi Yoichi,
Thanks for your solution

But, instead of copy data tabe to another sheet
it is possible to delete duplicates in same sheet itself

Hi,

How about delete all data in advance using Clear Sheet/Range/Table activity, then write datatable into the sheet?

Regards,

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