2

How can I tell Drupal 7 that 99 should go AFTER 100 when sorting items (descending) according to a number in URL or in Title?

I have this taxonomy view for magazine articles. Published issues range from 90 to 120, for now. Sorted ascending, the list goes from 100 to 120 and then 90, 91, and so on. Descending, I get 99, 98, 97.... 91, 90, 120, 119 and so on.

Sorting by posting date is not an option, since we're moving to the new Drupal site lots of old content and new issues will be loaded before very old ones.

2 Answers 2

1

Your data is being sorted alphabetically rather than numerically.

The simplest solution would be to store the 'Issue numbers' as an integer rather than as a sting. Views will sort numeric fields the way you're looking to sort them without any fuss.

This obviously won't work if you ever have issue numbers that contain anything but but numbers.

1

You might also try using the Views Natural Sort module to solve this problem. A natural sort algorithm is intended to order mixed alphabetic and numeric data much as a human being would.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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