A visual indication of how data is sorted in a browse can help you to locate specific data in the browse more quickly and efficiently. For example, if you are looking for a record for the customer “Zimmerman & Sons” and you know that the customer name column in the browse is sorted alphabetically in ascending order, you can quickly scroll down to the end of the data to find the record.

You can display sort-arrow indicators and sort-level numbers in browse column labels to indicate how the data is sorted. The sort-arrow indicator, which consists of an arrow bitmap pointing upward to indicate ascending sort order and pointing downward to indicate descending sort order, is displayed with the column label. It appears at the immediate right of the column label, whether the label is right-justified or left-justified. The following figure shows a sort-arrow indicator in the label for the Cust Num column indicating that this single column is sorted in ascending order.

Figure 1. Single-column sort indicator

The optional sort-level number indicates multi-level sorting and appears at the right of the sort-arrow indicator in the column labels. For example, you can set the sort-level number to show that data in one column of a browse has first been sorted in ascending order and data in another column of the browse has then been sorted in descending order.

The following figure shows sort-arrow indicators and sort-level numbers in the labels for two columns indicating that the City column was first sorted in ascending order and the Name column was then sorted in descending order (within City).

Figure 2. Multi-column sort indicators
Note: Setting a sort-arrow indicator and sort-level number on a column does not change the column’s sort order or the browse’s query. These sort indicator settings are independent of the associated query. You (the programmer) are responsible for synchronizing the sort indicators displayed in the browse and the sort order of data in the associated query. You typically define a START-SEARCH trigger for the browse in order to capture and respond to the user clicking on a column label.

In character interfaces, the ascending sort-arrow indicator is represented by the caret (0x5E) and the descending indicator is represented by the lower case “v” (0x76). These characters are not configurable. The sort-arrow indicator appears at the far right of the column label. This minimizes the chance of the user misreading the arrow as part of the column label.

The following BROWSE widget attributes and methods let you set and clear sort-arrow indicators and sort-level numbers for browse columns:

  • SET-SORT-ARROW( ) method — Sets the sort arrow indicator and, optionally, the sort-level number for a browse column
  • CLEAR-SORT-ARROWS( ) method — Clears sort arrow indicators for all columns in a browse
  • SORT-ASCENDING attribute — Indicates the sort order for a browse column
  • SORT-NUMBER attribute — Indicates the sort-level number for a browse column

For more information on these attributes and methods, see the ABL Reference.