Sorting Information Across the Page

Just as you can sort data down the page, you can sort data across the page using the keyword ACROSS.

When you use ACROSS, you produce a column for each unique value in the sort field. For example, if you have a field named QUARTER that contains the values FIRST, SECOND, THIRD, and FOURTH, then using ACROSS QUARTER produces four columns.

To count the number of employees in each department, issue the following request:

TABLE FILE EMPLOYEE
COUNT EMP_ID
ACROSS DEPARTMENT
END

Run the request. The output is:

Notice the column titles in this report. In Chapter 1, you learned that the field named by a verb command is used as a column title. This is not the case for this report. You do not see a column title for the field EMP_ID anywhere. This happens when you use ACROSS in a request that uses only one field after the verb. In this example, the single field is EMP_ID.

As with BY, you can enter more than one ACROSS in a report request. You can include up to 128.

Also, when the verb in a report request names more than one field, each of the fields is repeated for each value in the ACROSS phrase.

To sum the gross salary and deductions for each of the job categories in each department, issue the following request:

TABLE FILE EMPLOYEE
SUM GROSS DED_AMT
ACROSS DEPARTMENT
ACROSS CURR_JOBCODE
END

Run the request. The output is:

This report produces several screens to display the report. Only the first screen is shown here.

If there are many values in the field you specify with ACROSS, or if you use several fields with ACROSS, the report can become quite unwieldy.

WebFOCUS

Feedback