sortdownwithin
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

- groupdown -- divides the database into groups, with a summary record at the end of each group. The groups are arranged in descending order (high to low).
- groupup -- divides the database into groups, with a summary record at the end of each group. The groups are arranged in ascending order (low to high).
- importdatabasedialog -- opens the standard Import Database dialog.
- reverseorder -- reverses the order of the records in the database.
- sortdialog -- opens the standard *Sort* dialog.
- sortdown -- sorts the database by the current field. The database is sorted in descending order (high to low).
- Sorting Data -- sorting data into a specific order.
- sortup -- sorts the database by the current field. The database is sorted in ascending order (low to high).
- sortupwithin -- sorts the database by the current field, leaving any previous sorts intact. The database is sorted in ascending order (low to high).

History

Version | Status | Notes
10.0 | No Change | Carried over from Panorama 6.0.