[thelist] Custom sorting/ordering of query results

Ian Anderson ian at zstudio.co.uk
Tue Aug 23 09:39:30 CDT 2005

Frank wrote:

> This works perfectly. Now the client wants it custom sorted, so that 
> if the query returns records   1, 2, 4, 5, 6 He wants to be able to 
> sort it at will (such as 6, 2, 4, 1, 5 --or whatever his momentary 
> whim is).  Basically, it's retrieving the name of a category, and he 
> wants to control the order in which it displays on the page. 

Hi Frank,

surely the sort orders that he is requesting are not arbitrary;

You have a limited amount of data - products, product types, and 
categories. Assuming that all three values are being displayed, the 
display rules are surely things like:

1. list products alphabetically by product name, product type or category
perhaps combined with
2. grouped by type or category

I can't see there being any reason for truly random sorting, so surely 
you need to find out what the rules are he's actually asking for?

In situations where really random sort order is required, I use a 
sortOrder field and display sorted on that, but it doesn't sound like 
that is what is being asked for here...




More information about the thelist mailing list