Create the queries Manually Create the Data Model for Your Report

Building a Report Using a Preprinted Form 32-5 Figure 32–3 Data Model view with two queries 15. Save your report as preprint_your_initials.rdf.

32.2.2 Modify your data model

The steps in this section will show you how to modify your data model to link the two queries and to cause the data retrieved to break on a particular column.You will also create several summary columns to calculate information for each order. To modify your data model: 1. In the Data Model view, click the Data Link tool in the tool palette.

2. Click the CUSTOMER_ID column in the G_Customer group.

3. While holding down your mouse button, drag your cursor to the CUSTOMER_

ID1 column in the G_ORDER_ITEMS group and release your mouse button to create a link between the two queries.

4. Now, create a break group by clicking the ORDER_DATE column in the G_

ORDER_ITEMS group and dragging it above the group. Your data model should now look like this: Note: In Q_CUSTOMER, the second WHERE clause restricts the values returned to only those customers who have current orders. In Q_ORDERS, we have used to_char to account for a new datatype, Datetime. Since this new datatype is not recognized by Oracle Reports, you cannot use format masks on this particular column yet. Tip: You can select the group or the query title and use the resize handles to modify the look of your data model. 32-6 Oracle Reports Users Guide to Building Reports Figure 32–4 Data Model view of the linked queries and break group

5. Click the Summary Column tool in the tool palette, then click in the G_

CUSTOMER group to create a summary column. You may want to resize the group so that you can see your summary columns.

6. Double-click the new summary column object CS_1 to display the Property

Inspector, and set the following properties: ■ Under General Information, set the Name property to CS_PAGE_TOTAL. ■ Under Summary, set the Function property to Sum, set the Source property to ITEM_TOTAL, and set the Reset At property to Page. 7. Create another summary column in the G_CUSTOMER group, and set its properties as follows: ■ Under General Information, set the Name property to CS_ORDER_TOTAL. ■ Under Summary, set the Function property to Sum, set the Source property to ITEM_TOTAL, and set the Reset At property to G_CUSTOMER. Your data model is now complete, and should look like this: Note: These two summary columns calculate the total items per page and the total items in the order for the report. Building a Report Using a Preprinted Form 32-7 Figure 32–5 Complete Data Model view of the preprinted forms example

8. Save your report.

32.3 Create the Layout for Your Report

The steps in this section will show you how to create a layout that displays the objects in the desired locations on your preprinted form. You will start by adjusting the margin of your report, then creating the mailing label portion that will print at the top of each page that shows the address information for the customer. You will then create the body of the report, which contains the order information that display the date, order number, description, number, price per item, and total price.

32.3.1 Set up your report layout

Before you can start adding layout objects, you will need to adjust the margin of your layout. To set up the layout:

1. Click the Paper Layout button in the toolbar to display the Paper Layout view of

your report. 2. To make it easier for you to manipulate your layout objects, expand the size of the Paper Layout window. 3. Click the Edit Margin button in the toolbar to view the margin portion of the layout. 4. Using the resize handles, adjust the size of the margin the solid black bar to the dimensions of your form. In our example, our form is 8.5 inches by 11 inches 21.6 centimeters by 27.9 centimeters, so we will expand the margin to 8.5 inches 21.6 centimeters across, and 11 inches 27.9 centimeters down. Tip: You can use the corner resize handles to adjust the size of your margin.