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.

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:

Reference: Limits for Column Titles

  • The width allotted for column titles has no limit other than the memory available.
  • A column title for a styled output format can contain up to 16 lines of text.
  • You can replace a column title for a field named in an ACROSS phrase by only one line of text.

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:

  • To suppress the display of a column title, enter two consecutive single quotation marks without the intervening space. For example:
    PRINT LAST_NAME AS ''
  • To display underscores, enclose blanks in single quotation marks.
  • If you use an AS phrase for a calculated value, repeat the COMPUTE command before referencing the next computed field.
  • Multi-line column titles created with the AS phrase are not supported for ACROSS fields.

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:

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.

See the TIBCO WebFOCUS® Developing Reporting Applications manual for details on the TITLE attribute.

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.

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 TIBCO WebFOCUS® Developing Reporting Applications manual.
OFF
Disables qualified column titles. OFF is the default value.