7

Displaying progress records by sorting using any one attribute. I am new to progress so I want to know that how records in table can be displayed according to sorting on one attribute.

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
sajid shaikh
  • 81
  • 1
  • 3

1 Answers1

10

You use the BY phrase like so:

for each customer no-lock where customer.custNum > 100 BY customer.name:
  display customer.custNum customer.name.
end.

Keep in mind that selection and sorting are two different things -- the WHERE clause specifies selection (and in the absence of BY specifies the sort order), the BY specifies sorting.

BY will influence index selection only if there is a tie between two or more possibilities in the WHERE clause.

If the BY order does not match the WHERE order client side sorting may cause a significant performance penalty. (You can compile with XREF to see what indexes are being used and how well they match your desires.)

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33