- This topic has 2 replies, 2 voices, and was last updated 9 years, 3 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Integrated Application Platform
Integrated Application Platform › Forums › General › [SOLVED]Desending sort
I need to retrieve a set of records in a table sorted by a date field, but from the latest backwards. Can I use descending sorting in suneido instead of default ascending?
I read a thread posted back in 2001 on this forum saying that descending sorting was not implemented and it was suggested to use query.Prev. Could anybody post a piece of sample code for query.Prev method?
thanks a lot
You can sort reverse. e.g. stdlib sort reverse name (look in the help under Database > Queries > sort)
Note: you can only reverse the entire sort. If you are sorting by multiple fields you can’t reverse just one of them.
To read in reverse order, you can do something like:
WithQuery(query)
{|q|
while false isnt x = q.Prev()
...
}
Hi Andrew, That worked, thanks a lot for your help!