Graphics for the report

Building a Report with Dynamic Graphics 24-3

24.2 Create the Data Model with Two Linked Queries

The steps in this section will show you how to build a simple data model with two queries in a masterdetail relationship. To create a data model: 1. After you have updated the REPORTS_PATH with the images directory path, launch Reports Builder.

2. Choose File New Report.

3. Select Build a new report manually, then click OK.

4. 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.

5. In the SQL Query Statement field, enter the following SELECT statement:

SELECT ALL DEPT.DEPTNO, DEPT.DNAME, PICTURES.PICTURE FROM DEPT, PICTURES WHERE DEPT.DEPTNO = PICTURES.DEPTNO ORDER BY DEPT.DEPTNO

6. Click OK.

7. When the query displays in the Data Model view, right-click the query name Q_

1 , then choose Property Inspector from the pop-up menu to display the Property Inspector, and set the following properties: ■ Under General Information, set the Name property to Q_PICTURES. 8. In the Data Model view, double-click the picture column in the Q_PICTURES query to display the Property Inspector, and set the following properties: ■ Under Column, set the Read from File property to Yes, and set the File Format property to Image. Note: You can enter this query in any of the following ways: ■ Copy and paste the code from the provided text file called dynamicgraphics_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. Also note that if you have not installed the Pictures table into the sample schema, you will not be able to create this query. 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 24.1, Prerequisites for This Example describes the sample schema requirements for this example. 24-4 Oracle Reports Users Guide to Building Reports 9. In the Data Model view, follow the steps above to create another query named Q_ EMPLOYEES with the following code: SELECT ALL EMP.DEPTNO, EMP.ENAME, EMP.JOB, EMP.HIREDATE FROM EMP ORDER BY DEPTNO, ENAME 10. In the Data Model view, click the Data Link tool in the tool palette.

11. Drag a link between DEPTNO in Q_PICTURES and DEPTNO1 in Q_

EMPLOYEES . Your data model should now look like this: Figure 24–2 Data Model view for the dynamic graphics report 12. Save your report as dynamicgraphics_your_initials.rdf.

24.3 Create the Layout of the Report

In this section, you will create a default layout for your report using the Report Wizard. You will then modify all the necessary layout objects for your graphics.

24.3.1 Create the initial layout of your report using the Report Wizard

To create the initial layout:

1. In the Paper Layout view, choose Tools Report Wizard to display the Report

Wizard.

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

3. On the Style page, select Group Above.

4. On the Groups page, click the following groups in the Available Groups list and

click Down to specify the Print Direction and move them to the Displayed Groups list: Note: You can enter this query in any of the following ways: ■ Copy and paste the code from the provided text file called dynamicgraphics_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.