@ereddy068
Give a try to sort on numeric value. So you have rewrite the linq and removed the percent sign and Convert the remaining String to e.g. double
If I use below assign then I got output as below (From x In statisticsDt .AsEnumerable()
Order By convert.ToString(x("Incomplete“)) Ascending
Select x).CopyToDataTable()
Sorting is done perfectly but format is not correct for few values.
If I use Descending then I got output as below.
Is there anything I need to do for maintaining the same format for complete column
(From x In statisticsDt.AsEnumerable()
Order By convert.ToDouble(x(“Incomplete“).toString.replace(”%“,”").trim) Ascending
Select x).CopyToDataTable()
Kindly Note. Im travelling and do answer from my mobile. So it was Not possible to Check the Syntax. Maybe some corrections are to so. Maybe Convert does Not Like the comma. So do some Experiments in this direction
it look like the problem is in your excel and not in your variable, before store the data in that column try to take the column or sheet wherever to Text or number … and run it again …
The problem is not always in what you are doing it can be in what you alredy have.
I have got similar requirement to sort percentage in descending order and I have used the above code as mentioned and it found very helpful. But one issue is coming for 100%.it is coming at last while descending when it should be at the top. Can you provide the solution for this?I t would be helpful.I have used the below code.
(From x In statisticsDt .AsEnumerable()
Order By convert.ToString(x("Percentage“)) Descending
Select x).CopyToDataTable()
@Mohammed_Nawazuddin
we woukld suggest that you will open an new topic for your case along with some sample data. So we can adress individually your case. Thanks