Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ONE!
Ileana Bâlcu, Dulcian, Inc.
Summary
Oracle Reports is a tremendously powerful reporting tool. However, building the reporting portion of a system is usually time
consuming and tedious. By carefully designing the database and building a flexible reporting system, a complex set of
reporting requirements can be satisfied using a single report. This presentation will discuss our experiences building a
complex reporting system to support a general ledger system.
Note. Forms and Reports always run in different sessions. When you need to use a temporary table for a report, the code that
populates the temporary table should be included in the report and not in the calling parameter form.
3. Complex Reporting Front-End
A generic report needs a set of multiple parameters. The Report Builder has a Parameter Form facility, but it is very basic.
You can only use text items or select an item from a list. No LOV, radio buttons or checkbox functionality is provided. You
cannot have any interactions between parameters. For example, it is not possible to build a parameter form in Reports where,
if the department is filled in first, then only employees from that department will appear in the list.
You usually need to build a front-end that will gather the users’ preferences and launch the Report Runtime with the right
parameters. Forms Builder integrates well with Reports and provides a good environment for developing such Parameter
Forms.
4. Generic Sorts
This is the simplest application of the lexical parameters:
SELECT empno,ename
FROM emp
WHERE deptno=30
ORDER BY &p_sort
The user can choose to order the report alphabetically or by employee number by selecting a value from a list item. You need
to remember to set an Initial Value for the p_sort parameter, so that the user won’t get an error if he/she doesn’t select any
value.
5. Generic Breaks
If users need to view summaries grouped by various criteria such as summary per department or summary per job type, then
you need to create generic breaks as shown here:
SELECT empno
,sal
,&p_break break
FROM emp
WHERE deptno=30
ORDER BY &p_sort
In the Report Wizard you can set the break column in the master group and use either deptno or job as values for the
p_break parameter.
6. Generic Filters
This is another specific application of the lexical parameters. It basically means that you can control the WHERE clause of
the query by adding any appropriate filter. The user can then select the column to be filtered, the operation (which can be =,
<, LIKE, IN, etc.) and the filtering values.
SELECT empno,ename
FROM emp
WHERE &p_where
In the example above, the initial value of the p_where parameter should be 1=1 for an unfiltered report.
7. Columns to Display
The basic idea for selecting different columns to display is to use aliases for the columns.
SELECT &p_column1 column1,
&p_column2 column2,
&p_column3 column3
FROM emp
…
You need to set the initial value of the p_column parameters to ‘xxxxxxxxxx’.
If you need variable column lengths, then the problem becomes more complex and you will need to use the
SRW.SET_FIELD_ATTRIBUTE functions.
Note. You can find more detailed descriptions of the lexical parameters, generic sorts, filters, break columns, and columns to
display in Oracle Developer: Advanced Forms and Reports (Koletzke & Dorsey, Oracle Press, 2000).
Requirements Analysis
Anyone building a generic reporting system should be familiar with the techniques described above. However, there is no
universal method for building a generic reporting system. You need to do a thorough analysis of the reporting requirements
even before the data model is frozen. This analysis usually reveals any data model flaws that may make application and
reports development much more difficult later in the process.
In general, you should use generic data modeling techniques to support a flexible reporting system. Generic modeling gives
rise to models with relatively few tables that easily support flexible reporting. Rather than having lots of small tables with
similar structures, with a generic system, a single table that is typed that stores all objects of a similar structure. This enables
you to write a single reporting system that can simultaneously support many different types of objects.
At the root of the model is the idea of a “Book.” In this case, a “Book” consists of a collection of accounts (Book Details) in a
hierarchical structure. Different types of books (financial, managerial, etc.) could have different structures.
Each Journal Entry (JE) was attached to a particular Book. Journal entries consist of any number of debits or credits (JE
Details). Each JE detail debits or credits a particular book account (Book Detail).
One of the real strengths of the system was allowing JE Details to also be attached to a Department and a Job. This
effectively provided hundreds of virtual accounts, and the ability to maintain very complex accounting structures with little
maintenance.
The generic reporting system could then report not only for a book but also by department, job, or even the activity of a job
within a particular department.
Unfortunately, early attempts to build the system resulted in inadequate performance. Some information needed to be “pre-
aggregated” in order to return reports to managers in only a few seconds.
7. GL_REPORT_DTL – holds the columns definitions. Each report can have up to 6 column, defined by the following
attributes:
Conclusions
The amount of time spent on this project was:
13. Design - 200 hours
14. Prototype Development - 120 hours
15. Data Model Changes - 100 hours
16. User’s Feedback - 40 hours
From our experience in building this system and other reporting systems, the following tips are useful:
17. Include a thorough analysis of the reporting system early on the project, before even the data model is finalized.
Large number of reports can usually be reduced into a few report types through careful analysis.
18. Use abstract data modeling techniques to reduce software development and maintenance time. Even if you have a
great deal of experience with such systems, you should call in an auditor for your data model. The money spent for such
a task is well spent as opposed to risking project failure because of a flawed data model.
19. Keep users in the loop all the time; show them your progress and ask for other features that they need during
development.
20. Consider your users’ computer skills when creating the reporting interface. Many users are accustomed to Microsoft
Word or Excel.
21. Don’t design the whole reporting system first. Try building a simple report and then add more capabilities to it.
22. First provide users with the capabilities that they need for everyday tasks. Develop more complex functionality later
as users gain familiarity with the interface.
23. Manage user expectations about the project timeframe. Let your managers and users know that they may not be able
to see results for several weeks in the beginning.