Order List Using Caml Query in a text field as a number on SP 2010
-
07-02-2021 - |
Question
How can I order a Column where the type is text, but all the values stored are numeric,
I want to order it descending but considering the Column a Numeric field without changing the column type
Thank you
Solution 2
So This was my solution :
I created a Calculated column based on the original column with output type as numeric
There was a problem though. the calculated column at the beginning was returning the result as text too.
To fix this issue I had to do the following :
1.- ad a +"0" to the formula
I don't know how or why this worked, but doing this it transformed all the items into numeric.
OTHER TIPS
There is no way to do this using CAML.
You'd need to fetch the results then sort using JavaScript.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange