Get entire datatable based off distinct values in one colun

Server Name Alert Severity Title Text
Server1 Critical Needs Reboot
Server2 Critical Needs Upgrade
Server2 Major Needs Upgrade
Server3 Major Needs Update
Server1 Major Needs Reboot

lets say i have the table above. I want to filter the entire table and return the entire table based off unique values in the Server Name column. So my output would look like the below

Server Name Alert Severity Title Text
Server1 Critical Needs Reboot
Server2 Critical Needs Upgrade
Server3 Major Needs Update

what is the easiest way to do this with UiPath. I can do it with excel functions. but i havent found a good way to do with UiPath. I have tried the default table method but it only returns 1 column of info and i want all the other columns as well.

Any help is greatly appreciated!

Hi @david.rya.goderre ,

Kindly try this assign.

dtFiltered = dt.AsEnumerable().GroupBy(Function(x) x.Field(of String)("ColumnName")).Select(Function(y) y.First()).CopyToDataTable

dt = Datatable you want to filter
“ColumnName” = Your Column Name, in this case “Server Name”
dtFiltered = Your new datatable

Regards

1 Like

This did exactly what i needed! thank you for the help!

I’m glad it worked for you, I wish you good learning :slight_smile:

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