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, 7 of 12


Modifying the Layout of Columns

Key format attributes

You can specify format attributes within a ROW command to modify the column layout or the way the labels and data values are represented.

The following table lists the ROW attributes you will use most often.

Attribute 

Abbreviation 

Description 

CENTER 

C 

Centers the value within its column. 

DECIMAL n 

D n 

Shows n decimal places. 

INDENTn 

 

Indents the value n spaces within its column. 

LEFT 

L 

Left-justifies the value within its column. 

LSET'text' 

 

Adds text to the left of a value. 

OVER 'text' 

 

Overlines the column with the first character of text

PAREN 

 

Uses parentheses to indicate negative values. 

RIGHT 

R 

Right-justifies the value within its column. 

RSET 'text' 

 

Adds text to the right of the value. 

SPACE n 

SP n 

Precedes the column with n spaces. 

UNDER 'text' 

 

Underlines the column with the first character of text

VALONLY 

 

Underlines or overlines the value only, not the entire column; VALONLY is used only with UNDER or OVER. 

WIDTH n 

W n 

Makes the column n characters wide. 

Tip: For convenience, you can use abbreviations when they are available for an attribute. For example, you can abbreviate WIDTH as W.

The effect of using format attributes

The attributes in a ROW command affect only the row produced by that command. They have no effect on subsequent output rows created by other ROW commands, even when the same expressions are shown.

Overriding OLAP DML format options

The default values of some ROW attributes are controlled by OLAP DML format options. For example, the DECIMALS option determines the default value of the DECIMAL attribute in the ROW command.

If you specify an attribute in a ROW command, then the attribute overrides the value of the corresponding OLAP DML option.

Example: Modifying decimal places and column width

This example calculates the ratio of actual sales to budget sales. It shows a label in a label column that is 16 characters wide and a data value with four decimal places in a data column that is 6 characters wide.

row width 16 'Percent of Plan', decimal 4 -
   width 6 sales / sales.plan

The above commands produce a row of output such as the following.

Percent of Plan  0.7593

Example: Calculating the width of a data column

This example calculates the width of the UNITS column based on the current value of the LSIZE option. The command

row skip, w lsize / 5 units

produces the following output.

200

Example: Underlining values

The following command uses the hyphen character to underline the UNITS data column.

row skip, under '-' units

This command produces the following output.

                  200 
               ----------      

Applying attributes to more than one expression

To apply an attribute to more than one expression in a row, you can specify the attribute once and enclose the expressions in angle brackets. Attributes that apply to more than one data expression are called global attributes.

Place the global attributes just before the angle brackets, then place any attributes that apply to just one expression within the angle brackets.

Tip: If you want to use the same format throughout most of your report, then you might be able to set a format option instead of specifying format attributes.

Example: Applying format attributes to two expressions

The following command sets the width of the columns for both SALES.PLAN and SALES to nine characters. In addition, it specifies a different number of decimal places for each data expression.

row district, w 9 <d 0 sales.plan, d 2 sales>

The above command produces the following output.

BOSTON            42,347 32,153.52

Using different attributes in different rows

You might want to use different format attributes for data in different rows of a report. For example, you might want to insert a dollar sign to the left of values in the first row of a report but not in subsequent rows.

You can store the desired attribute arguments in variables dimensioned by one or more dimensions of your data, and specify the variables as arguments to the format attributes in your ROW commands.

Example: Using different attributes in different rows

If your report shows sales data with districts going down the page, then you can insert a dollar sign for the sales value for the first district, BOSTON, but not for the other districts.

First, define a text variable named DOLLAR.SIGN, dimensioned by DISTRICT. In the DOLLAR.SIGN variable, store a dollar sign ($) for BOSTON and blank characters for the other districts. To enter a blank character in DOLLAR.SIGN, specify two single quotes with nothing between them, as shown below.

limit district to 'BOSTON'
dollar.sign = '$'
limit district complement
dollar.sign = ''

In your report program, specify DOLLAR.SIGN as the argument to the LSET attribute.

limit district to all
for district
   row across month: lset dollar.sign sales

Related information

For more information, see the following table.

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

ROW attributes, including a complete listing of attributes along with their default values and the corresponding OLAP DML options, 

the entry for the ROW command in the OLAP DML Reference 


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