Use the Data Wizard to Create Two Queries

Building a MasterMaster Report 8-3

5. On the Data page, enter the following SELECT statement in the Data Source

definition field: SELECT DEPARTMENT_ID, DEPARTMENT_NAME, LOCATION_ID FROM DEPARTMENTS

6. Click Next.

7. On the Groups page, click Next.

8. Click Finish to display the data model for your report in the Data Model view.

9. Repeat the steps above for a second query, but this time name your query Q_Emp and use the following SELECT statement: SELECT LAST_NAME, FIRST_NAME, JOB_ID, SALARY FROM EMPLOYEES ORDER BY LAST_NAME, FIRST_NAME Figure 8–3 Data model with two unrelated queries

8.4 Use the Report Wizard to Layout the Data

Once your data model is complete, you need to create a layout for the data objects to display in the report output. The Report Wizard enables you to create layouts for your data model. Note: You can enter this query in any of the following ways: ■ Copy and paste the code from the provided text file called masterb_code.txt into the Data Source definition field. ■ Click Query Builder to build the query without entering any code manually. ■ Type the code in the Data Source definition field. Note: If you are not already connected to a database, you will be prompted to connect to the database when you click Query Builder or Next. Ensure that you connect to a database that has the appropriate schema for this example. Section 8.1, Prerequisites for This Example describes the sample schema requirements for this example. 8-4 Oracle Reports Users Guide to Building Reports To create the layout:

1. In the Data Model view, right-click on the canvas, then choose Report Wizard.

2. In the Report Wizard, on the Report Type page, select Create Paper Layout only.

3. On the Style page, select Tabular.

4. On the Groups page, ensure that both groups from your data model appear in the

Displayed Groups list.

5. On the Fields page, click the double right arrows to move all of the fields to

the Displayed Fields list. 6. On the Template page, select Predefined Template and click Beige, then click Finish to display your report output in the Paper Design view. The output for the Department report should look something like this: Figure 8–4 Paper Design view for the MasterMaster report

8.5 Use the Paper Layout View to Add White Space

If you scroll down in the Paper Design view, you will notice that the field labels from the second query, Q_Emp, are located directly below the fields from the first query, Q_ Dept. In fact, they are almost touching each other. For this report, you will move all of the layout objects belonging to Q_Emp down the page to create some white space between the two layouts. To create white space between the layouts: 1. Move and resize the Report Editor window such that you can easily view it and the Object Navigator simultaneously. Tip: When you have multiple queries in your data model, make sure that you check the names of the groups associated with each query prior to entering the Report Wizard. The Report Wizard requires you to choose data for the layout by group name.