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
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.
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
interactivetools.com
Re: [Dave] Reorder records
By soj - March 25, 2008 - edited: March 26, 2008
Wow, I missed that option in the editor.
I'd like to order by 'record number' ascending, but it's not taking.
soj
Update - I found what I was doing wrong - I confused field name with field label. Thanks!
I'd like to order by 'record number' ascending, but it's not taking.
soj
Update - I found what I was doing wrong - I confused field name with field label. Thanks!