How to sort Percentage Column as descending order from Datatable

Hi,

I have a requirement where I need to sort Percentage Column as Descending Order. I have used assign activity as datatable and in Value I have passed the code : From x In statisticsDt .AsEnumerable()
Order By convert.ToString(x("Percentage“)) Descending
Select x).CopyToDataTable()
I am getting output as below
image

I am getting 100% at last but 100% should be at top.

Any suggestions would be helpful.

Thanks,
Nawaz.

Hi,

Can you try the following expression?

(From x In statisticsDt .AsEnumerable()
Order By Int32.Parse(System.Text.RegularExpressions.Regex.Match(x("Percentage").ToString,"\d+").Value) Descending
Select x).CopyToDataTable()

Regards,

1 Like

Hi Yoichi,

Thanks for your quick reply. The above expression is working fine but as ascending order.Please find the below snap
image

I need the expression for descending order.It would be helpful if you can provide expression for descending order.

Thanks,
Nawaz.

Hi Yoichi,

The expression worked. Thank you.

Thanks,
Nawaz.

1 Like