Oracle® Fusion Middleware Oracle Reports User's Guide to Building Reports 11g Release 1 (11.1.1) Part Number B32122-02 |
|
|
PDF · Mobi · ePub |
When you create a report, you can either use the Report Wizard to assist you or create the report yourself. In this example, you will use the Data Model view to create your two queries, then use the tool palette to create a data link between the two queries to relate the data tables.
To create two queries:
Launch Reports Builder (or, if already open, choose File > New > Report)
In the Welcome or New Report dialog box, select Build a new report manually, then click OK.
In the Data Model view that displays, click the SQL Query tool in the tool palette then click in an open area of the Data Model view to display the SQL Query Statement dialog box.
In the SQL Query Statement field, enter the following SELECT
statement:
SELECT ALL DEPARTMENTS.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME, DEPARTMENTS.MANAGER_ID, DEPARTMENTS.LOCATION_ID FROM DEPARTMENTS
Note:
You can enter this query in any of the following ways:Copy and paste the code from the provided text file called acrossbreak_code.txt
into the SQL Query Statement field.
Click Query Builder to build the query without entering any code manually.
Type the code in the SQL Query Statement field.
Click OK.
The data model for your new query displays:
Create another query, this time using the following code:
SELECT ALL EMPLOYEES.LAST_NAME, EMPLOYEES.FIRST_NAME, EMPLOYEES.DEPARTMENT_ID FROM EMPLOYEES ORDER BY EMPLOYEES.LAST_NAME
Note:
You can also copy and paste the code from the text file provided in the acrossbreak folder, calledacrossbreak_code.txt
.Click OK.
In the Data Model view, click the Data Link tool in the tool palette.
Click and drag your mouse from DEPARTMENT_ID column in Q_1, to DEPARTMENT_ID1 in Q_2 to create a data link between the two queries.
Your data model should now look like this:
Figure 12-3 Data Model of the two linked queries
Note:
You can right-click the data link, then choose Property Inspector from the pop-up menu to ensure that the data link was created properly.