How to compare rows in the same datatable in uipath?

Hi All,

Please help me to compare rows in a same datatable. In a datatable, there 2 columns(Name and Marks). If Name is same in 2 rows then compare the Marks and keep the row having highest Marks and remove the other row from the datatable.


Welcome back to our UiPath community.

  1. Let’s say your input DataTable is dtInput.
  2. And then try below expression to get the required output.
dtOutput = dtInput.AsEnumerable.GroupBy(Function(r) r("Name").ToString).Select(Function(g) g.OrderBy(Function(r) Cint(r("Marks").ToString.Trim)).Last).CopyToDataTable

Hi ,
Please find the attached workflow (67.7 KB)

It worked. Thank you for the solution.

Thank you for the solution

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