0

I did the following:-

  1. I have added an announcement list APP.
  2. Create a new date & time calculated column (named Announcement Date) with the following formula” =TEXT(Date,"dd Mmm, yyyy")”
  3. Then on the AllItems views , I mention to filter based on the Date field Descending.
  4. But I decide to hide the Date field and view the announcement date field only, in the AllItems view as follow:- enter image description here

  5. Currently the sort is working well, but if I decide to manually do the sort . by select Descending form the calculated field drop down then the sort will be wrong , and it will be based on the Day and not the date , so for example 29 January 1999 will be grater than 1 december 2013 !!. Although sorting based on announcement date descending should be the same as doing the sort based on the Date descending. enter image description here

Can anyone advice what is causing this strange behavior !! Thanks.

2

Your formula:

TEXT(Date,"dd Mmm, yyyy")

returns a string type, not a Date.

This means the values in the column will be sorted as strings, not as dates. While the sorting is behaving correctly, the result will be confusing to the user, so you might want to consider turning off sorting for this calculated column.

  • Another option could be to use XSLT to format the date the way you want it - that way it is still a date field so can still be sorted. However, this is not as simple as a calculated field. – Dave Paylor Oct 8 '13 at 20:29
  • no i think at this stage i will go with the option to disable sorting for this column . but how i can do this ? – john Gu Oct 8 '13 at 20:45
  • The best way is to set the Sortable property with code. If that isn't an option, try editing the view using SharePoint Designer. In the code window, find the FieldRef element for your column in the ViewFields section. Add Sortable="FALSE" to the element and save your changes. – Rich Bennema Oct 9 '13 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.