Displaying progress records by sorting using any one attribute

sajid shaikh picture sajid shaikh · Sep 8, 2011 · Viewed 7.4k times · Source

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.

Answer

Tom Bascom picture Tom Bascom · Sep 8, 2011

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.)