sortupwithin
sortupwithin

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

Parameters

No parameters.

Description

The sortupwithin statement sorts the database in ascending order (from low to high) by the current field. However, it leaves any previous sort intact. For example, suppose a procedure sorts by State, then uses sortupwithin on the City field. The result is that the states will remain in order, but within each state the cities will now be sorted. This process can be repeated as many times as necessary.

This example sorts a database by both City and State at the same time.

    field State
    sortup
    field City
    sortupwithin

The sortupwithin 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 sortupwithin 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 sortupwithin statement, a procedure can use the regular sortup statement, but sort the fields in reverse order. Like the previous example, this example sorts by cities within states.

    field City
    sortup
    field State
    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).
- sortdownwithin -- sorts the database by the current field, leaving any previous sorts intact. 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).

History

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