Add Logic for Text

23-6 Oracle Reports Users Guide to Building Reports 6. Again, repeat the steps above, but this time drag from top left corner of B_ALL3 to the top left corner of B_ALL2. Figure 23–3 Property Inspector with anchor properties displayed To create format triggers:

1. In the Paper Layout view, double-click B_SALESREP to display the Property

Inspector, and set the following properties: ■ Under Advanced Layout, double-click the Format Trigger property field to display the PLSQL Editor.

2. In the PLSQL Editor, use the template to enter the following PLSQL code:

function B_SalesrepFormatTrigger return boolean is begin if :comm = 500 then returnTRUE; else returnFALSE; end if; end; This boilerplate will print only in the letters to employees whose commissions are greater than 500.

3. Repeat the steps above, but this time enter the following PLSQL for B_ALL2:

function B_ALL2FormatTrigger return boolean is begin if :comm 500 or :comm is null then returnTRUE; else returnFALSE; end if; end; This logic causes B_ALL2 to print only in the letters where B_SALESREP does not print. Building a Conditional Form Letter Report 23-7 Figure 23–4 Paper Layout view of modified report

4. Compile, save, and run your report. Page through the form letters to see that some

have the dinner invitation while others have the thank you message.

23.5 Summary

Congratulations You have successfully created a conditional form letter report. You now know how to: ■ create a data model and a layout. ■ add text. ■ anchor objects together and create format triggers to control whether the text displays. 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 Tip: To preview this report for a specific destination type, in the Paper Design view, choose File Preview Format, and select the destination type. Your report output will display as though using Printer fonts instead of screen display fonts, and you can get a clearer indication of the appearance for example, line wrapping of the printed report. In addition, when you print a conditional form letter report on stationery as illustrated, be sure to take into account the position of the letterhead, and so on, when creating the layout so the text of the letter fits into the overall design of the stationery. 23-8 Oracle Reports Users Guide to Building Reports hosted on the Oracle Technology Network OTN, as described in Section 4.1.1, Using the Oracle Reports online Help .