TIP: Sorting Items with "Sort rank" setting, by Date

This is an open forum for any mojoPortal topics that don't fall into the other categories.

This thread is closed to new posts. You must sign in to post in the forums.
9/25/2013 9:08:07 AM
Gravatar
Total Posts 29

TIP: Sorting Items with "Sort rank" setting, by Date

Something that came up from our editors was, "How can we sort our newsletter links by date?" We have a page using the List/Links feature to let users download back issues of quarterly newsletters. It's a pain to go through all the items and adjust their Sort Ranks to keep them in order each time a new link is added.

I tested something, and it worked! The "Sort Rank" field will accept negative numbers!

So, to sort items by date using Sort Rank:

  1. Start the "Sort Rank" field with a negative sign (a dash), to sort with the newest item first. No sign to sort with oldest item first.
  2. Set the first two digits of the Sort Rank to the year
  3. Set the last two digits to the month.
  4. If needed, set two more digits to the day of the month.

If the content editors do this when the items are created, then there is no problem. They must remember to be consistent. Six digits for sorting by month, or eight digits for sorting by day, consistently for every item in the feature.

Examples:

  • For the newsletter of September 2011, the Sort rank is -1109. For June 2012, it's -1206. By setting these date codes to negative, they appear with the newest entry on top.
  • For issues that come out more than once a month, like June 1 2013 and June 15 2013, it works the same way. Their Sort Rank numbers are -120601 and -120615, respectively. And they are displayed in correct order.

Hope this helps somebody.

You must sign in to post in the forums. This thread is closed to new posts.