It's all about the answers!

Ask a question

Sort Work Item Query on a Custom Attribute

Steven Melcher (6012430) | asked Aug 11 '11, 4:07 p.m.
In RTC, is it possible to add Custom Attributes to the list of attributes to sort the results of a work item query by?

In the Web Client, I did not see the custom attributes listed as items that could be sorted on.

Todd Goldstein commented Jan 13 '12, 9:36 a.m. | edited Jul 12 '12, 4:07 p.m.

I have this same problem in 3.0.1. Any ideas on how to fix this? Is it an attribute setting when you create it or is this a defect?

John S F Lander commented Jul 12 '12, 9:58 a.m.

Have the same problem - as no response will raise an enhancement request

Accepted answer

permanent link
Millard Ellingsworth (2.5k12431) | answered Jul 12 '12, 4:54 p.m.
edited Jul 12 '12, 7:44 p.m.
I just tried this via the Web UI in both 4.0 and using custom attributes of type Small String and Timestamp and the custom attributes show up in the pick list for Sort Order (and I can select them and use them). The Add Sort Column picker list does not do a case insensitive sort, so if you happened to add attribute whose name begins with a lower case letter, it will show up at the bottom of the list. Since other attribute lists (like the picker for adding an attribute to an Editor Presentation) _do_ use a case insensitive sort, it seems likely that you gave up looking for the attributes because they weren't where you expected them.

I also tried with a Large String (the default type when adding a custom attribute), and that does not show up as a sort option -- which is normal, Description (a Large HTML field) doesn't show up as a sortable field either as the "Large" fields are not stored as normal database columns (so we can't sort on them).

So I think this works fine and as intended with the caveat that the attribute collection mechanism does not populate the list with a case insensitive sort (as some of the other attributes lists do).

@John Lander I see that the enhancement you filed was specifically about using the Contributor Attribute Kind and not Custom Attributes in general. I tried your example in 4.0 and don't see a Sponsor in the sort list there -- I will add comments to your work item.
Ralph Schoon selected this answer as the correct answer

3 other answers

permanent link
Ralph Schoon (61.6k33643) | answered Jul 14 '12, 9:54 a.m.
 I think this was not possible in 2.x

permanent link
Majdi Asaad (12) | answered Nov 14 '14, 5:10 p.m.
I have a custom attribute with type contributor. I am unable to sort on this field. I am able to sort on other custom attributes (i.e. string). I am on 5.0.0

permanent link
Bareket Matmon (1714) | answered Mar 28 '18, 9:25 a.m.


I'm also trying to sort custom attribute (from type: Large HTML), but I couldn't find it in 'Sorting' list. how I can add it there? 

Jürgen Brückler commented Mar 29 '18, 8:45 a.m.

 Unfortunately Eric's answer from 2012 is still valid:

Your answer

Register or to post your answer.