In this SharePoint 2013 caml query tutorial we will discuss how to use SharePoint CAML Query Order by in SharePoint 2013/2016/Online. In this example, we will use CAML Query with Order by a condition for a dropdown column in SharePoint 2013.
When I was working with one SharePoint 2013 list having a dropdown column with values from 1 to 13.
I want to filter data order by the dropdown column. But when we use dropdown column directly in caml query it will not filter in the same order as it will consider 1, 10, 11, 12, 13, 2,3,4.. in this order.
For such type of requirement just create one more calculated column as shown below:
You may like following SharePoint CAML Query examples:
- How to Use CAML Query for Boolean field for SharePoint 2013/2016/Online Object Model CSOM
- Download, Install and Use CAML Query Helper in SharePoint Online/2013/2010/2007
- Caml query builder SharePoint 2013 Online
- CAML Query Builder for SharePoint 2013/2016/Online
- Filter CAML Query by List Item ID in SharePoint Online/2013/2016
- Task assigned to user or current user groups in SharePoint 2010 using CAML query
Then add this column and use this column in order by instead of dropdown column. This will solve the problem. Hope this helps someone.
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.