Sort DataTable Activity Not Working as Expected

Hi,
I am having problem with sorting the datatable. we have a list of columns that have multiple values. I am trying to sort the table by particular columns as descending order. However it’s not outputting properly. The input value is stored as Double and other columns are stored as “String”.
Please see the attached for sample data

sampleout

As you can see it’s not sorting properly. I am trying to sort it by “Balace” Columns. Excel file is just to show what the table would look like with random number.

Hi , You can use code manually to get that done

Pls use below function in assign activity to sort the DataTable

dt=dt.AsEnumerable.OrderBy(function(r) CType(System.Text.RegularExpressions.Regex.Match(r(0).ToString,“[\d.]+(?=%)”).ToString,double)).CopyToDataTable

In the above Function I have sorted based on ‘%’

I forgot to mention. we stored the data as array of string and stored it inside the data table. that’s the only thing i can think of why sort activity is not working.

i used this method to sort it

DataView dv = dt.DefaultView;
dv.sort =“columns desc”
DataTable sortedDt = dv.Table;

Then i use sort table activity again to sort it.

Not sure why i have to sort 2 times but it works

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