Reorder records

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 25, 2008   (RSS)

By soj - March 25, 2008

Hi all, I'd like to reorder records in a staff list. Can anyone tell me how to do this via the system? Ascending vs Descending would be enough. TIA!

soj

Re: [soj] Reorder records

By Dave - March 25, 2008

Hi soj,

You can specify the sort order in the "Order By" field in the section editor or in the list viewer.

So, say you had a stafflist with a field called fullname, you could sort by the name (in ascending order) with this option:

$options['orderBy'] = "fullname";

Because this is just a regular MySQL "Order By" clause, you can use standard MySQL. So to sort in descending order you just add "DESC" after the fieldname like this:

$options['orderBy'] = "fullname DESC";

Would that work for you? Let me know if it will or if there was something else you were trying to do.
Dave Edis - Senior Developer
interactivetools.com