How to distinct a datatable for all columns

I have this table that contains around 10 columns. There are some datas that are completely identical to all of the columns. Let say for example
|Gender| |Name| |Age|
M Mark 10
M Mark 10
M Alex 12
F Alex 12
F Alex 15

My output should be
|Gender| |Name| |Age|
M Mark 10
M Alex 12
F Alex 12
F Alex 15

I know how to distinct on one column like for age:
|Gender| |Name| |Age|
M Mark 10
M Alex 12
F Alex 15

What I need is to only group/distinct the rows, if all of the column datas are identical.

Hi @Archie ,
use below syntax to get distinct value
DataTable =DataTable.DefaultView.ToTable(true)
Refer below link
DataTable filtering with expressions - News / Tutorials - UiPath Community Forum

Regards,
Arivu

2 Likes

Hi @Archie

First create a datatable variable like Out_DT

Use this below syntax in assign activity

Out_DT=(
                From row in Input_DT
                Group row By a =row("Gender"),b=row("Name"),c=row("Age") into grp =Group
                Select grp.First
               ).CopyToDataTable

Hope its solves your issue

Thanks,
Robin

1 Like

Thanks. The linked helped me. The DataTable =DataTable.DefaultView.ToTable(true) also worked.

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