Naming Columns: Field Names and AS

In order to include data in a report, you need to identify which fields you want to retrieve from the data source. You identify which fields you want to include using the appropriate field names.

Fields have different formats. Two types of formats we use in our examples are alphanumeric and numeric.

Alphanumeric fields contain characters and/or digits. Even if the field contains only digits, it cannot be used in calculations. For example, social security numbers or zip codes are not used in mathematical calculations.

Numeric fields, which include decimal and integer formats, contain numbers for use in calculations.

Each field name or TITLE attribute in the Master File serves as a title for the column it produces and sets the width for that column. If the length of a particular field value is greater than the field name, the column is automatically sized to be as wide as the field length.

When you write a report request, you can include a keyword called AS that changes the default column title. Since field names are used as titles for columns, type AS next to the field name for which you want to provide a new column title. Then, type the new title after AS and enclose it in single quotation marks ('). If you want more than a one-line title, use a comma (,) to indicate where each new line begins. You can include up to 16 lines in your column titles.

To produce a two-line title, issue the following request:

TABLE FILE EMPLOYEE
LIST EMP_ID LAST_NAME CURR_SAL AS 'CURRENT,SALARY'
END

Run the request. The output is:

Notice the new column title in this report. Each time you want to change a title, simply include another AS keyword after the appropriate field name.

WebFOCUS

Feedback