To create or edit a formula column:
In
the Data Model view, single-click in the tool palette,
then:
To create a column within a group, click in the group at the position you want the column placed in the hierarchy.
To create a report-level column, click in an open area of the canvas region.
Double-click the formula column object to display the Property Inspector.
Under the Placeholder/Formula node, double click the PL/SQL Formula property value field.
In the PL/SQL Editor, define the PL/SQL for the formula (for example, SAL * 0.07).
Suppose that you have a report with the following groups and columns:
Groups Columns Summary
----------------------------------------
RGN REGION
RGNSUMSAL SUM(DEPTSUMSAL)
COSTOFLIVING
DEPT DNAME
DEPTNO
DEPTSUMSAL SUM(EMP.SAL)
JOB JOB
HEADCOUNT COUNT(EMP.EMPNO)
EMP ENAME
EMPNO
SAL
COMM
Given these groups and columns, you might create multiple formulas that apply
the cost of living factor (COSTOFLIVING
) to salaries. To avoid
duplication of effort, you could create the following PL/SQL function and reference
it from the formulas:
function CompSal(salary number) return number is
begin
return (salary*CostofLiving);
end;
Following are some examples of how you might reference the PL/SQL function in formulas:
CompSal(:RGNSUMSAL)
or
CompSal(:SAL) + COMM
Creating a summary column (for total or subtotals)
Creating or editing a placeholder column
The chapter titled "Building a Group Left Formula
Report" in the Oracle Reports Building Reports manual, available
on the Oracle Technology
Network Oracle Reports Documentation page (http://www.oracle.com/technology/documentation/reports.html
).
Copyright © 1984, 2005, Oracle. All rights reserved.