Customizing a Column Title

In this section:

How to:

Reference:

A column title identifies the data in a report. Use the AS phrase to change the default column title for customized data identification or more desirable formatting. You can change a column title:

A column title defaults to the field name in the Master File. For a calculated value (one created with COMPUTE), the title defaults to the field name in the request.


Top of page

Example: Using Default Column Titles

Consider this request:

TABLE FILE EMPDATA
SUM SALARY
BY DEPT
BY LASTNAME
WHERE DEPT IS 'SALES' OR 'CONSULTING' OR 'ACCOUNTING'
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

The report output illustrates these default column titles:

The output is:


Top of page

x
Reference: Limits for Column Titles

Top of page

x
Syntax: How to Customize a Column Title in a Request
						fieldname AS 'title_line_1 [,title_line_2,...]'

where:

fieldname
Is a field named in a display command (such as PRINT or SUM), ACROSS phrase, or BY phrase.
title_line_1,title_line_2
Is the customized column title, enclosed in single quotation marks.

To specify a multiple-line column title, separate each line with a comma.

To customize a column title for a calculated value, use the syntax:

COMPUTE fieldname[/format] = expression AS 'title'

For related information, see Creating Temporary Fields.

Tip:



Example: Customizing Column Titles in a Request

This request customizes the column titles for the field named in the SUM command (SALARY), and the fields named in the BY phrases (DIV and DEPT).

TABLE FILE EMPDATA
SUM SALARY AS 'Total,Salary'
BY DIV AS 'Division'
BY DEPT AS 'Department'
WHERE DIV EQ 'NE' OR 'SE' OR 'CORP'
HEADING
"Current Salary Report"
ON TABLE SET STYLE *
TYPE=REPORT,GRID=OFF,$
ENDSTYLE
END

The output is:



Example: Suppressing a Column Title

This request suppresses the column title for LAST_NAME. It also illustrates a multiple-line column title (EMPLOYEE NUMBER) for the data for EMP_ID.

TABLE FILE EMPLOYEE
PRINT FIRST_NAME AS 'NAME' AND LAST_NAME AS '' 
BY DEPARTMENT
BY EMP_ID AS 'EMPLOYEE,NUMBER'
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

The output is:



Example: Customizing a Column Title for a Calculated Value

This request customizes the column title for the calculated value REV.

TABLE FILE SALES
SUM UNIT_SOLD RETAIL_PRICE 
COMPUTE REV/D12.2M = UNIT_SOLD * RETAIL_PRICE;AS 'GENERATED REVENUE' 
BY PROD_CODE
WHERE CITY EQ 'NEW YORK'
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

The output is:


Top of page

x
Customizing a Column Title in a Master File

You can change the default column title using the optional TITLE attribute for a field. Any formatting you apply to the field will be applied to its customized title. For an illustration, see Justifying a Report Heading.

See the Describing Data With WebFOCUS Language manual for details on the TITLE attribute.


Top of page

x
Distinguishing Between Duplicate Field Names

How to:

The command SET QUALTITLES determines whether or not duplicate field names appear as qualified column titles in report output. A qualified column title distinguishes between identical field names by including the segment.

Column titles specified in an AS phrase are used when duplicate field names are referenced in a MATCH command, or when duplicate field names exist in a HOLD file.



x
Syntax: How to Distinguish Between Duplicate Field Names
SET QUALTITLES = {ON|OFF}

where:

ON
Enables qualified column titles when duplicate field names exist and SET FIELDNAME is set to NEW (the default). For information on SET commands, see the Developing Reporting Applications manual.
OFF
Disables qualified column titles. OFF is the default value.

WebFOCUS