Create a formula column to calculate the tax

Building a Group Left Formula Report 14-5 7. Close the Property Inspector. You have created a formula column that calculates the tax 7 of each order.

14.3.2 Create a formula column that calculates customer order totals

To create a formula column that calculates customer order totals: 1. Repeat Steps 2 and 3 from Section 14.3.1, Create a formula column to calculate the tax : click the Formula Column tool in the tool palette, then click in the G_ ORDER_ID group under TAX. Then, double-click CF_1 to display the Property Inspector. 2. Change the name of the column to SALES_TOTAL. 3. Open the PLSQL Editor and modify your formula so that it looks like this: function SALES_TOTALFormula return Number is sales_total number; begin sales_total := :ORDER_TOTAL + :TAX; return sales_total; end;

4. Click Compile.

5. If no errors display, click Close. If errors display, verify that your code looks

exactly like the above code, paying close attention to the column names. 6. Close the Property Inspector. You have created a formula column that calculates the total orders of each customer. Your data model should now look something like this: Figure 14–4 Data Model with Formula Columns

14.3.3 Add the formula columns to the report layout

Now that you have created your formula columns, you must add them to your report layout. The easiest way to do this is to return to the Report Wizard. 14-6 Oracle Reports Users Guide to Building Reports To add formula columns to your report layout:

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

2. In the Report Wizard, click the Fields tab. In the Available Fields list, you should

now see your two new formula columns. Click each one, then click the right arrow to move them to the Displayed Fields list.

3. Click Finish to display your report output in the Paper Design view. It should

look something like this: Figure 14–5 Final formula report output

14.4 Summary

Congratulations You have successfully created a formula paper report. You now know how to: ■ define a report layout using the Report Wizard. ■ create two formula columns and add them to your report. 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 .