Stump the Panel: SharePoint Q&A

Immediate solutions for common SharePoint questions
It is currently Fri May 24, 2013 5:11 pm

All times are UTC - 5 hours [ DST ]


Forum rules


What you are viewing is an archive of Stump the Panel. It remains for reference purposes. Please post all new questions on NothingButSharePoint.com
https://www.nothingbutsharepoint.com/sites/eusp/Forum



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Need to Sort in order other than Alpha or Numeric...
PostPosted: Wed Apr 20, 2011 2:06 pm 
Offline

Joined: Wed Apr 20, 2011 12:50 pm
Posts: 6
I'm tracking projects (List of Projects) with multiple task items (List of Project Ref # and a dozen task items per). Each of the dozen tasks per project has it's own separate status field.

The status possibilities are:
Critical [Worst]
Advisory [Bad]
Verified [Good]
Created [Best]

I need to present the single record per Project Ref # with the worst status and/or earliest date.
My plan was to sort on "Status" from Worst to Bad, then display the distinct row based on Ref # (should be first row after the sort above).

I have attempted several different ideas to force the sort order of "Status" using the "xsl:sort" function, but none are working.

Obviously, there is no 'natural' sort order. Values not alphabetical and have no numerical sequence.
When I sort the rows based on this field, I can only get it to display as:
Advisory
Created
Critical
Verified

Can someone help me find the best way in a DVWP using XSL and/or a complex Xpath sorting expression to sort this way and then present the first record of each set of repeating "ref #"?


Top
 Profile  
 
 Post subject: Re: Need to Sort in order other than Alpha or Numeric...
PostPosted: Wed Apr 20, 2011 2:27 pm 
Offline
User avatar

Joined: Mon Jan 04, 2010 1:15 am
Posts: 1839
Location: North Carolina
The easy answer would be to change the choice values to
1-Critical
2-Advisory
3-Verified
4-Created
and then use ascending sorting on that column.

When there isn't a natural sort order, you have to create one somehow.


Top
 Profile  
 
 Post subject: Re: Need to Sort in order other than Alpha or Numeric...
PostPosted: Wed Apr 20, 2011 2:56 pm 
Offline

Joined: Wed Apr 20, 2011 12:50 pm
Posts: 6
I appreciate the input - and was afraid that might be the case. My users are not very fond of the idea. What about creating a list starting with the worst to best, and then filtering based on the order of the ID's in that list? Do you think that would work?


Top
 Profile  
 
 Post subject: Re: Need to Sort in order other than Alpha or Numeric...
PostPosted: Wed Apr 20, 2011 3:25 pm 
Offline
User avatar

Joined: Mon Jan 04, 2010 1:15 am
Posts: 1839
Location: North Carolina
Another alternative would be to use a workflow to update a hidden sort column on creation. Based on the choice, you set the field to 1, 2, 3, or 4 and can sort and filter on that field.


Top
 Profile  
 
 Post subject: Re: Need to Sort in order other than Alpha or Numeric...
PostPosted: Wed Apr 20, 2011 7:39 pm 
Offline
User avatar

Joined: Sat Jan 02, 2010 6:02 pm
Posts: 1035
Location: Silver Spring, MD
You could create a calculated column that represents your sort order. That would have less moving parts and a little more flexible if you want to add more logic to your sorting later on down the road.


Top
 Profile  
 
 Post subject: Re: Need to Sort in order other than Alpha or Numeric...
PostPosted: Mon Apr 25, 2011 8:42 am 
Offline
User avatar

Joined: Mon Jan 04, 2010 1:15 am
Posts: 1839
Location: North Carolina
That works too, or could be done via a jQuery PreSaveAction on creation, lots of options.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group