How to use LINQ on a DataTable in Uipath

Supriyo picture Supriyo · Aug 8, 2020 · Viewed 11.1k times · Source

I am trying to filter a datatable using LINQ Query on Uipath and save the output as datatable format. Where col A has name and Col B has Price. I am trying to filter where price is greater than a value ( price>500) and save both Name and Price of filtered result to a datatable.

Please find the image which I am trying to do.LINQ Query from OutDT

Answer

AnkitKwar picture AnkitKwar · Aug 16, 2020

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.