In this chapter, you will learn about reports that generate different versions of a form letter based on changing conditions. By following the steps in this chapter, you can generate the report output shown in Figure 23-1 and Figure 23-2.
The two form letters above were generated from the same report. As you can see, the two letters share a number of features. Hence, it is more convenient to create a base form letter and then apply conditions to certain parts to determine whether they should be displayed for the current record, in this case, employees.
Conditional printing is useful when you want to display a section of a report only if certain conditions are met at run time. Conversely, you may wish to use conditional printing to suppress certain information for those who don't need it.
This report uses one query to select all data.
This report uses the Form Letter layout style. You'll also create the various pieces of boilerplate that will comprise the letter. To govern the printing of these boilerplate objects, you'll use vertically collapsing anchors and PL/SQL format triggers to conditionally produce different form letters for employees who meet the specified criteria.
In this example, you will create a form letter to invite all of your employees to the company picnic. For your top sales representatives, though, you also want to include a special invitation to a dinner party in the form letter. For all other employees, you want to include a thank you without the dinner invitation.
As you build this example report, you will:
Add Logic for Text, which involves anchoring objects together and creating format triggers to control whether the text displays.
To see a sample conditional form letter report, open the examples folder named
condform, then open the Oracle Reports example named
condform.rdf. For details on how to access it, see "Accessing the Example Reports" in the Preface.