Scraped Data is loaded in to the DataTable with all columns as String by default(No Choice to set Column Data Type). So not able to sort correctly

Scrapped Data from website is loaded in to the DataTable(flight_details) with all columns as String type by default(No Choice to set Column Data Type).
Columns are “Flight Name”, “Duration”,“Arrival Time”, “Dept Time”, “Fare”.
I Want to sort the data row based on Column “Fare” in ascending showing cheapest flight 1st. But due to string data type sorting is not sorting the rows as expected. Please help to change the column “Fare” data type to Integer to allow correct sorting or any other way.

Give a try on using an assign activity with following statement that will return the filtered Datatable

YourDataTable.AsEnumerable.OrderBy(Function (row) CInt(row(“Fare”).ToString).CopyToDataTable

hi @ppr solution is for @SandeepPanchal not for me :slight_smile: :slight_smile:

@Ajju Sorry :slight_smile:

This error is thrown.

below is the assign activity.

ExtractDataTable = ExtractDataTable.AsEnumerable.OrderBy(Function (row) CInt(row(“Fare”)).ToString).CopyToDataTable

Please suggest.

so we just have to adopt the string/number conversion Lets give a try on CDbl instead of CInt.
But it seems to me that also a currency sign is within the value. So for quick prototype using the substring in combination with trim could be an option for the next run


Use below code in assign activity

Extstrong textractDataTable = ExtractDataTable.AsEnumerable.OrderBy(Function (row) row(“Fare”)).CopyToDataTable