DataTable - Get the row with minimum value of a given column

I can use Datatable.AsEnumerable().Min(Function(row) row(“Value”)) to return the minimum value…
However i would like to return the entire row…
Please help

Hello @Selwyn_Van_Rooyen

You can use this custom activity…
https://go.uipath.com/component/datatable-plugins

Use the data table consolidate activity to get the minimum value along with the entire row…

There is a user guide attached to the component which you can use to understand how it is used.

1 Like

@Selwyn_Van_Rooyen
Following statement is retrieving the min rows

(From r In dtDemo.AsEnumerable
Let m As Int32 = dtDemo.AsEnumerable.Min(Function (row) row.Field(Of Int32)(1))
Where r.Field(Of Int32)(1)=m
Select r).toList

Assumptions: Column for the min calculation contains integer values

So just adopt the DataTableVarName, ColumnName or Index according your code.

In case of you can rely that only 1 row will be returned feel free to use additional a first() Statement after toList Statement (But change also the Datatype from list to DataRow)

About the Statement: Statement is doing an integrated filtering

Happy Automation :slight_smile: