Ordering PDF's
Hi I have uploaded multiple PFD's that are named by date, eg. July 2000, April 2000, May 2000. I want these to be displayed according to a calendar year, ie. from Jan to Dec. How can this be achieved?
August 25th, 2011 8:31am

You'll need to create a calculated column in the library that extracts the year from the title. You can then create a view that sorts and groups by that column. A second column that contains just the Month (converted to a number) would allow a secondary sort by month.Paul Stork SharePoint Server MVP Chief SharePoint Architect: Sharesquared Blog: http://dontpapanic.com/blog Twitter: @pstork
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2011 8:40am

Is there a 'How to' on the above?
August 25th, 2011 8:57am

Hi, This can be done very easily. Follow these steps: 1. Go to the settings of the document library. 2. Create a column type of dateTime. 3. Execute a console application that will copy the title mentioned into this column by converting it to the form. 4. Now create a view or you can modify the existing view and you can use . 5. Now go to view settings and under sort select this created column. I hope this will help you out.Thanks, Rahul Rashu
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2011 9:16am

How do I do step 3. Execute a console application that will copy the title mentioned into this column by converting it to the form. Thanks
August 25th, 2011 9:29am

Hey Vasu, Assumption: Title column value is in format of Jan XXXX , April XXXX ... etc 1. Create a Custom Calculated custom in List, you can name is like.... Ordering or whatever you like 2. Add Formula by selecting the column as below =MONTH([Title]) 3. Click ok. 4. Modify the required view, and set the sorting / grouping for above custom calculated column u created. Let us know if you need some more help on this.Thanks Akhilesh Nirapure
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2011 10:24am

Hi, I have developed the code for console application as per your need and I have tested it in my dev box also. It is running fine there as well. These are some points before we go to the code: 1. The document library I created with name SortDateDocs 2. The column of type datetime is created as SortDate. Now here is the code using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint; using System.Collections.Specialized; using System.Collections; namespace RahulDateSort { class RahulData { static void Main(string[] args) { using (SPSite site = new SPSite("YourSiteURL")) { SPWeb web = site.OpenWeb(); SPDocumentLibrary documentLibrary =(SPDocumentLibrary) web.Lists["SortDateDocs"]; String title = string.Empty; String month = string.Empty; String year = string.Empty; string[] comb = null; Hashtable months = new Hashtable(); months.Add("January", "1"); months.Add("February", "2"); months.Add("March", "3"); months.Add("April", "4"); months.Add("May", "5"); months.Add("June", "6"); months.Add("July", "7"); months.Add("August", "8"); months.Add("September", "9"); months.Add("October", "10"); months.Add("November", "11"); months.Add("December", "12"); String monthNumber = string.Empty; String fullDate = string.Empty; foreach (SPListItem item in documentLibrary.Items) { title = (String) item["Title"]; comb = title.Split(' '); month = comb[0]; year = comb[1]; monthNumber = (String)months[month]; fullDate = "01/" + monthNumber + "/" + year; DateTime date = Convert.ToDateTime(fullDate); item["SortDate"] = date; item.Update(); } } } } } I hope this will help you out. If anything is not clear for you in this code do let me know.Thanks, Rahul Rashu
August 25th, 2011 1:46pm

Our solution to this problem was to add a date field and force the users to fill it up. If you can't programm, my proposal is to use excel! You add the date field (date only i.e. MYDATE) and then export to xls. In there you can: a) either put the values yourself at the feld MYDATE, much faster b) make an xls formula to calculate the field MYDATE, accoarding to filename. Now, the tricky part: You go to Sharepoint and show the list in spreadsheet mode! Assuming that the xls and the list in spreadsheet mode are in the same order, you copy-paste the column MYDATE !!! Christos
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2011 4:01pm

Thanks to all for your assistance. I have solved the problem.
September 18th, 2011 5:40am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics