Oracle9i OLAP Services Developer's Guide to the OLAP DML
Release 1 (9.0.1)

Part Number A86720-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Writing Reports, 8 of 12


Creating Headings

Overview of the HEADING command

You use the HEADING command to create titles, column headings, and side headings in reports. The HEADING command is like the ROW command except that any numbers shown in headings are not added in when you generate totals of the columns or rows in your report.

The HEADING command has the same syntax as the ROW command. You can use any of the ROW format attributes with the HEADING command to change the format of titles and headings.

The HEADING command creates rows of output with the same default layout as those produced by the ROW command. The first expression you specify in the HEADING command is shown in the labels column, and the remaining expressions are shown in the data columns.

Creating report titles

You use the HEADING command to create titles on your reports. To center a title on a page, you use the CENTER attribute along with a WIDTH attribute that specifies the column width as the width of the page.

Example: Centering a title

For example, to center a title on a page that is 54 characters wide, you can use the following command.

heading w 54 c 'Unit Sales'

This command produces the following title.

Unit Sales

Example: Incorporating text values in a title

Your title can be any character expression. For example, if you are creating a report for each district, then you can incorporate the current district in your title.

heading w 54 c joinchars('Unit Sales for ' district)

If the current district is Boston, then this command produces the following title.

Unit Sales for BOSTON

Creating column headings

You also use the HEADING command to create headings for columns of data. When you create column headings, you use the same layout that you use for the data columns. You can use any ROW command attributes to format the headings.

Tip: Be sure the format attributes in the HEADING command that creates the column headings match the format attributes in the ROW commands for the corresponding data columns in your report program. If the attributes do not match, then the headings will not line up properly with the data columns.

Example: Creating headings for month columns

If you report unit sales data for Boston for the first three months of 1996, then you will want to label the columns with the names of the months. You can use the following commands in a report program.

limit month to 'JAN96' to 'MAR96'
heading skip, across month: w 6 sp 4 c -
   under '=' valonly month

The following report headings are produced.

                  JAN96     FEB96     MAR96
                  =====     =====     =====

This example uses the WIDTH attribute to specify the width of the columns, CENTER to center the month values in the columns, UNDER to underline the month values, and VALONLY to underline just the month values and not all of the values.

Creating side headings

You can also use the HEADING command to create side headings in a report. For example, suppose your program loops over the DISTRICT dimension to create rows of data for each district in status. You can use the HEADING command to generate a label for each district.

Example: Creating side headings for rows of data

Suppose that you have a program that loops over the DISTRICT dimension to create rows of data for each district. The following commands insert a row that contains the name of the district before the rows of data for each district.

for district
   do
   heading under '=' valonly district
   .
   .            "Row commands
   .
   doend

The commands produce output with the following format.

BOSTON
======
   .
   .
   .
ATLANTA
=======
   .
   .
   .

Formatting time dimension headings

The values of a time dimension are formatted according to the VNF attached to the dimension definition. Or, if a time dimension does not have a VNF of its own, then the values are formatted according to the default VNF for the type of time dimension you are using.

For additional flexibility in formatting the values of a time dimension in a report, you can override the dimension's VNF (or the default VNF) by using the CONVERT function with a VNF argument.

Example: Customizing column headings for MONTH

To override the VNF for the MONTH dimension when you create month headings in a report, you can use commands such as the following.

limit month to 'JAN96' to 'MAR96'
heading skip, across month: w 10 sp 2 c under '=' - 
   convert(month text '<mtextl>')

The following headings are produced.

                January     February     March
                ==========  ==========  ==========

Related information

For more information, see the following table.

IF you want documentation about . . .  THEN see . . . 

the default VNFs and for instructions on how to assign a VNF to a time dimension, 

the topic for the VNF command in the OLAP DML Reference 

attributes that you can use with the HEADING command, 

"Creating Headings" 


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback