Hi,
It is probably easiest to describe my feature request by my own example where it would be needed. I'm a Views novice, so perhaps there's some other way to accomplish this already in Views--but here goes:

I have a CCK text field named field_priority. It has 5 key|label values to select from:
2|High
5|Medium
7|Low
9|null (default)
10|Complete

I want to sort using the KEY values(since alphabetical sort of labels would give you Complete-High-Low-Medium which is not desirable) instead of the LABEL. Unfortunately, I can only sort with "Content - field_priority" using the labels apparently. Since CCK fields with key|label are pretty ubiquitous(i think??), this feature should be added to Views.

I was able to resolve my problem by creating a second Computed Field named field_priority_sort which computes and returns the KEY instead of the value, and I can sort using that fine-- but it would have been very cool if sorting by KEYS was already native to Views.

Thanks.

Patrick

Comments

merlinofchaos’s picture

Project: Views (for Drupal 7) » Content Construction Kit (CCK)
Version: 6.x-2.1 » 6.x-2.x-dev
Component: Miscellaneous » Views Integration

f you only read one of these submission guidelines, read this one. (Then please read the rest) If your problem deals exclusively with fields or filters provided by another module (CCK, Image, VotingAPI are common) please post the issue under the queue for that module first; all modules are responsible for telling Views about their own fields. It's possible Views IS at fault, but the module maintainers are the best people to make that determination, and they can kick the issue into the Views queue with an explanation of what's wrong if that is the case.

yched’s picture

Status: Active » Closed (works as designed)

Only the keys are stored in the db. Views sorts being SQL sorts, it is only possible to sort according to the keys.