The text in B_SALESREP and B_ALL2 applies only to some employees. Hence, you need to apply a condition to each one to determine when it should appear. You also need to ensure that objects (for example, B_ALL2 and B_ALL3) move up in the layout whenever objects above them (for example, B_SALESREP and B_ALL2) do not print. Otherwise, you will have large gaps in your report output for employees who do not get all of the objects. To achieve this, you must anchor the text objects together.
In the Paper Layout view, click the Anchor tool in the tool palette.
Click and drag a line from the top left corner of B_SALESREP (the second text object) to the top left corner of B_ALL (the first text object). Double-click to create the new anchor object.
Choose Tools > Property Inspector to display the Property Inspector for the anchor object:
Set the Child Edge Percent and Parent Edge Percent properties to 0.
Set the Collapse Vertically property to Yes.
Click the title bar of the Report Editor to make it the active window again.
Repeat the steps above, but this time drag from top left corner of B_ALL2 to the top left corner of B_SALESREP.
Again, repeat the steps above, but this time drag from top left corner of B_ALL3 to the top left corner of B_ALL2.
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 PL/SQL Editor.
In the PL/SQL Editor, use the template to enter the following PL/SQL code:
function B_SalesrepFormatTrigger return boolean is begin if :comm >= 500 then return(TRUE); else return(FALSE); end if; end;
This boilerplate will print only in the letters to employees whose commissions are greater than $500.
Repeat the steps above, but this time enter the following PL/SQL for B_ALL2:
function B_ALL2FormatTrigger return boolean is begin if ((:comm < 500) or (:comm is null)) then return(TRUE); else return(FALSE); end if; end;
This logic causes B_ALL2 to print only in the letters where B_SALESREP does not print.
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.
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.