sortdownwithin

The sortdownwithin statement sorts the database by the current field, leaving any previous sorts intact. The database is sorted in descending order (high to low).


Parameters

No parameters.


Description

The sortdownwithin statement sorts the database in descending order (from high to low) by the current field. However, it leaves any previous sort intact. For example, suppose a procedure sorts by Category, then uses sortdownwithin on the Price field. The result is that the categories will remain in order, but within each category the items will now be sorted by price (from highest to lowest). This process can be repeated as many times as necessary.

This example sorts a database by both Category and Price.

field Category
sortup
field Price
sortdownwithin

The sortdownwithin statement can be used over and over again to sort three, four, or more fields within each other. Always start with the regular sortup or sortdown statement followed by as many sortdownwithin statements as required for additional fields.

Advanced Note: Since Panorama uses a stable sort algorithm, there is an alternate way to sort multiple fields. Instead of using the sortdownwithin statement, a procedure can use the regular sortdown statement, but sort the fields in reverse order. Like the previous example, this example sorts by Price within Category.

field Price
sortdown
field Category
sortup

See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.