Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Re: 'newupdate' links showing up last

Quote Reply
Re: 'newupdate' links showing up last In reply to
You might want to add DESC after isNew and see if that makes a difference.

One "gotcha" is that isNew is an ENUM field, and if Yes is defined before No, then Yes will be "0" and No will be "1". This is backwards from what you might expect, but it's the array (field, set, whatever) position that determines ENUM sort order, not the actual value.

Sorting is a tricky thing, since if you try to sort on multiple fields, you have to look at how those fields interact. The first sort key will be how they are sorted first, the second key will determine how, giving the results of the first key-sort, can the results be sorted further, and the third, even further.

So, if you pick "Priority, isNew" as the criteria, then (assuming things work as expected, rather than how they do) Links will be sorted first in priority order, ascending, then within each of those priorities, the links will be sorted by isNew ascending.

If your lowest priority links have "new" links in them, they will appear at the END of the listing. First sort is by priority, _THEN_ by new.

To get new links at the top, you want to make sure that "priority" doesn't override "isNew".

So, sort by isNew, Priority DESC

This will put all "new" links (if Yes was defined before No) at the top of the list, and sort those by Priority, with the highest priority at the top. It will then take all the non-new links, and sort those, putting the highest priority on the top.

Make sense??

If you want to then sort by Alpha, you can add "Title" to the sort list, and then within each "priority" group you'd have links sorted alphabetically.

If you reversed it, isNew, Name, Priority ... what will happen?

Your new links will be at the top arranged in alphabetical order, if two links have the same title, the one with higher priority will be listed first.

The rest of the links will effectively be sorted by Name, since the "Name" field is pretty unique, it effectively overrides any effect "Priority" would have on the results, unless two links had the same title, in which case Priority would make a difference.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Subject Author Views Date
Thread 'newupdate' links showing up last mgeyman 3363 Nov 28, 2000, 11:17 AM
Thread Re: 'newupdate' links showing up last
mgeyman 3286 Nov 28, 2000, 1:51 PM
Thread Re: 'newupdate' links showing up last
qango 3289 Nov 28, 2000, 2:23 PM
Thread Re: 'newupdate' links showing up last
mgeyman 3288 Nov 28, 2000, 7:48 PM
Post Re: 'newupdate' links showing up last
Stealth 3269 Dec 5, 2000, 9:20 PM
Post Re: 'newupdate' links showing up last
pugdog 3255 Dec 5, 2000, 9:37 PM