Sorting on Several Fields

You can show more detail by sorting on additional fields. You name each field with its own sort phrase. A report can have up to 128 sort phrases.

For example, issue a report request that summarizes the gross salary payments for the employees in each department. This data is stored in the fields GROSS, DEPARTMENT, and EMP_ID.

Issue the following request:

TABLE FILE EMPLOYEE
SUM GROSS AS 'TOTAL,GROSS PAY'
BY DEPARTMENT
BY EMP_ID
END

Run the request. The output is:

Look at the layout of the fields in this report. When you name several fields as sort fields, the first sort field named in the request, in this case, DEPARTMENT, appears on the left-hand side of the report. This field is called the highest order or primary sort field. The next sort field named, in this example EMP_ID, appears to its right and is called a low order or secondary sort field. Sort fields appear on the report from left to right in the same order they are specified in the request. Note that the GROSS PAY values include dollar sign ($) and comma (,) edit options.

WebFOCUS

Feedback