Datatable sorting with respect to particular column value

Hi Team,

I have a datatable with various columns.
I want to sort the rows depending on the column “InvoiceNo.”. Like if the invoice numbers are 001 and 002 then the row that has 001 as invoice number will be the 1st row and then 002 invoice number row as the 2nd row.

Please help.

Maybe better when sharing the sample data with us.

Give a try at

dtSorted =

dtDataVar.AsEnumerable.OrderBy(Function (x) CInt(x("InvoiceNo.").toString.Trim)).CopyToDataTable
2 Likes

Hi @yash.choursia ,
you can Use the Sort Data Table activity to sort the DataTable based on the “InvoiceNo.” column.
Input DataTable: Set it to the DataTable you want to sort (inputDataTable).
Column Name: Choose “InvoiceNo.” from the dropdown list.
Direction: Set it to “Ascending” if you want the invoice numbers sorted in ascending order.

Let me know if it works.

Follow the below steps you can resolve the issues

If this InvoiceNo. column contains alphanumeric then? Like invoicenumbers are like ABC-1111,ABC-67123. Something like this. Without spliting, is there any other option
?

I think the order by provided by @ppr should still work. Are you encountering any specific issues?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.