How to sort data table retreived from Data scraping?

I have extracted data through data scraping in data table dt1. It contains two columns viz. Name and Price. The data in this dt1 is of String type. Now if I want to sort the data table on basis of Price, it is not sorting. The reason behind it as per my understanding is that sorting would be only possible if Price column data was of Integer type but currently it is of string Type. What should I do now to sort the data?

Hi @Vikram_Rai - Try the below expressions in Assign Activity

Sort data table in Ascending Order - DT.AsEnumerable.OrderBy(Function(x) Cdbl(x("Price").ToString)).CopyToDataTable

Sort data table in Descending Order - DT.AsEnumerable.OrderByDescending(Function(x) Cdbl(x("Price").ToString)).CopyToDataTable

Ref Workflow - (3.3 KB)

DT.asenumerable.Orderby(Function(r) CDbl(r(“Price”))).Copytodatatable

Hey @Vikram_Rai ,

Have a look on this LINQ | Sort Datatable Using LINQ | LINQ Uipath Tutorials | Coderslobby - YouTube