Run Your Report to Paper Summary

Building an Across Group Report 12-5 Figure 12–5 Paper Design View of the Across Group Report 2. Save your report as acrossbreak_your_initials.rdf.

12.5 Summary

Congratulations You have successfully created an across group paper report. You now know how to: ■ manually create a data model with two queries. ■ create a masterdetail report using the Report Block Wizard. For more information on any of the wizards, views, or properties used in this example, refer to the Oracle Reports online Help, which is available in Oracle Reports Builder or hosted on the Oracle Technology Network OTN, as described in Section 4.1.1, Using the Oracle Reports online Help . 12-6 Oracle Reports Users Guide to Building Reports Building a Group Left Summary Report 13-1 13 Building a Group Left Summary Report In this chapter, you will learn about group left summary reports. By following the steps in this chapter, you can generate the report output shown in Figure 13–1 . Figure 13–1 Group left summary report output Concepts ■ This report consists of master records Name, at the upper left of the figure above, detail records Product, Itemtot, and Orderdate, to the upper right, and summary records Product, and Sum Total. The summary calculates totals for the details under each master record. Notice that the column Product appears twice. With Reports Builder, you can display columns any number of times. ■ A masterdetail summary report is a masterdetail report that also contains one or more summaries. Data Relationships ■ This report will use two queries to select data from four tables. The master query will select the customer name, while the detail query will select the information associated with the products ordered by each customer. 13-2 Oracle Reports Users Guide to Building Reports ■ Because the detail query will select data from several tables, youll need to specify joins to link the information in the tables together. ■ Youll drag a column out of the detail group to further group the data. Youll also create a summary column to calculate the item totals. Layout ■ The layout for this report is constructed in two parts. The top portion contains the master and detail information, and is created using the Report Wizard. The second portion is constructed by hand in the Paper Layout view and formats the summary. ■ Youll also resize two groups in the layout to ensure that the new, user-created bottom portion of the layout is integrated into the top portion, omit some columns from the layout that were queried only to join the tables, and include more space between instances of a repeating frame. Example Scenario In this example, you will create a report that displays and summarizes sales data by customer. This report would include the following for each customer: ■ a list of the products they purchased by order date and how much they spent on each product ■ a summary for each customer that shows how much they spent in total on each product over time As you build this example report, you will: ■ Create a New Report Manually to create a new, empty report. ■ Create a Data Model with a Data Link between two queries. ■ Use the Paper Layout View to Create Two Layouts . ■ Merge the Two Layouts to combine the separate layouts into one. ■ Format Fields to format monetary values. To see a sample masterdetail summary report, open the examples folder named masterdetailsummary, then open the Oracle Reports example called grp_above_ summ.rdf. For details on how to access it, see Accessing the Example Reports in the Preface.

13.1 Prerequisites for This Example

To build the example in this chapter, you must have access to the Summit Sporting Goods SUMMIT schema. To download the SQL scripts that install the schema, see Accessing the Data Sources in the Preface.

13.2 Create a New Report Manually

In this case, it is easier to create the data model and layout separately. Hence, we will create an empty report first, then add the queries, and then create the layouts. To create a blank report:

1. Launch Reports Builder or, if already open, choose File New Report.

Building a Group Left Summary Report 13-3

2. In the Welcome or New Report dialog box, select Build a new report manually,

then click OK.

13.3 Create a Data Model with a Data Link

When you create a report with multiple queries, it is typically easier to create all of the queries with the Data Wizard first and then create the layouts with the Report Wizard. To create the queries:

1. In the Data Model view, choose Insert Query to display the Data Wizard.

2. If the Welcome page displays, click Next.

3. On the Query page, type Q_Customer for the Query name, then click Next.

4. On the Data Source page, select SQL Query, then click Next.

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

definition field: SELECT CUSTID, NAME FROM CUSTOMER ORDER BY NAME

6. Click Next.

7. On the Groups page, click Next.

8. Click Finish to display your first query in the Data Model view.

9. Repeat the steps above for a second query, but this time name your query Q_Item and use the following SELECT statement: SELECT CUSTID, DESCRIP, ITEMTOT, ORDERDATE, ITEM.ORDID FROM ORD, PRODUCT, ITEM WHERE ITEM.ORDID = ORD.ORDID AND ITEM.PRODID = PRODUCT.PRODID ORDER BY CUSTID, DESCRIP, ORDERDATE Note: You can enter this query in any of the following ways: ■ Copy and paste the code from the provided text file called grp_above_summ_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 13.1, Prerequisites for This Example describes the sample schema requirements for this example.