score:2

Accepted answer

d1.asEnumerable.where(Function(x1) CInt(x1("salary"))>500).copyToDatatable

or

d1.asEnumerable.where(Function(x1) x1("salary")>500).copyToDatatable if the salary column is already an integer

You may need to add Assembly reference as System.Data.DataSetExtensions if drop down does not appear after you type d1.asEnumerable.

score:0

Filter with LINQ:

(From row In YourDataTable.AsEnumerable Where CInt(row("price").ToString) > 500 Select row).CopyToDataTable

If you found error message:

AsEnumerable is not a member of 'System.Data.Datatable'

Please add reference below to your xaml file.

<AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>

Reference: https://forum.uipath.com/t/asenumerable-is-not-a-member-of-system-data-datatable/69198/2?u=akkapolk

score:0

You can also work in a function method approach to LINQ rather than a SQL-like syntax.

DT_Data = DT_Data.AsEnumerable.Where(
  Function(x) CINT(x("Price")) > 500
).CopyToDataTable

You can treat data in the DataTable with .Select(Func) Returning you a collection of however you treat the data.


Related Articles