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


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.