Skip Headers
Oracle® Fusion Middleware Oracle Reports User's Guide to Building Reports
11g Release 1 (11.1.1)

Part Number B32122-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

23.4 Add Logic for Text

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.

To create collapsing anchors:

  1. In the Paper Layout view, click the Anchor tool in the tool palette.

  2. 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.

  3. 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.

  4. Click the title bar of the Report Editor to make it the active window again.

  5. Repeat the steps above, but this time drag from top left corner of B_ALL2 to the top left corner of B_SALESREP.

  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

Description of Figure 23-3 follows
Description of "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 PL/SQL Editor.

  2. 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.

  3. 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.

    Figure 23-4 Paper Layout view of modified report

    Description of Figure 23-4 follows
    Description of "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.

    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.