Oracle9i OLAP Services Developer's Guide to the OLAP DML Release 1 (9.0.1) Part Number A86720-01 |
|
Writing Reports, 7 of 12
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.
Tip: For convenience, you can use abbreviations when they are available for an attribute. For example, you can abbreviate WIDTH as W.
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.
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.
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
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
The following command uses the hyphen character to underline the UNITS data column.
row skip, under '-' units
This command produces the following output.
200 ----------
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.
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
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.
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
For more information, see the following table.
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|