|Oracle® Fusion Middleware Oracle Reports User's Guide to Building Reports
11g Release 1 (11.1.1)
Part Number B32122-03
|PDF · Mobi · ePub|
In this chapter, you will learn about matrix reports. By following the steps in this chapter, you can generate the report output shown in Figure 25-1.
Figure 25-1 Matrix report output
A matrix report looks like a grid. As shown by the example report above, it contains one row of labels, one column of labels, and information in a grid format that is related to both the row and column labels.
This sample matrix also contains three additions to the basic matrix: summaries have been added, zeroes replace non-existent values in the cells, and the cells themselves are surrounded by grid lines. Of the summaries, one sums the salaries by department, one sums them by job, and one sums them for the whole report.
Certain requirements exist for building matrix reports:
You must have at least four groups in your data model.
At least two of the groups must be within the cross product group. These groups furnish the "labels" of the matrix report.
At least one group must be a "cell" group; that is, it must provide the information related to the labels. The values from this group fill the cells created by the matrix.
These requirements can be seen in the preceding example. It contains four groups--one group supplies the vertical labels (department numbers) and one group supplies the horizontal labels (job identifiers). These two groups are the children of the third group, called the cross product group, which creates the grid. The fourth group provides the values that fill in the grid.
Matrix reports are different from tabular reports because the number of columns is not known in advance; that is, the number of columns in your report is not determined by the number of columns you specify in your
SELECT statement plus the columns you create yourself. The number of columns in your report depends on the number of values contained in the columns providing the horizontal and vertical labels. Thus, the report would automatically be extended if a new job function, called RECEPTIONIST, was added to the underlying data tables.
The queries used to select data for these sample matrix reports are not intended as definitive examples of matrix queries. If you are concerned with performance issues, for example, there are alternate methods of querying data that can improve the performance of a matrix report.
You can create matrix reports with any number of queries. Section 25.2, "Create a Single-Query Matrix" explains how to create the matrix report using one query. Section 25.3, "Create a Multiple-Query Matrix" explains how to create the same report using three queries. These two methods yield the same results. They are presented as options; feel free to try both methods and settle on a favorite.
This report uses the matrix layout style. You'll modify some default settings to ensure that the column and row labels display correctly. You'll also modify some field widths to ensure that the fields fit across the page.
For additional conceptual information, see Section 1.3.7, "About matrix reports",
In this example, you will create report that cross tabulates salaries by job function and department. The result would be a matrix with job functions listed across the top, departments down the side, and sums of salaries in the cells. Thus, you could quickly determine the sum of all of the salaries for clerks in department 20 and compare that value to the one for all clerks in some other department.
As you build this example report, you will:
Add Summaries to the Single-Query Matrix for rows and columns.
Add a Grid to add grid lines around cells.
To see a sample matrix report, open the examples folder named
matrix, then open the Oracle Reports example named
matrix1qb.rdf for a single-query matrix report, or
matrix3qb.rdf for a multi-query matrix report. For details on how to access these reports, see "Accessing the Example Reports" in the Preface.