Add a Format Trigger to Suppress Labels

Building a Report that Suppresses Labels 21-7

2. Double-click the properties icon next to M_G_DEPTNO1_HDR 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. 3. In the PLSQL Editor, use the template to enter the following PLSQL code: function M_G_DEPTNO1_HDRFormatTrigger return boolean is begin if :count_detail=0 then return FALSE; else return TRUE; end if; end;

4. Click Compile.

5. When there are no compiling errors, click Close.

6. Save your report as suppresslabels_your_initials.rdf.

21.6 Add Text to Display when No Records Display

The steps in this section will show you how to add boilerplate text to your report layout that will display when no records are retrieved. To add boilerplate text: 1. In the Paper Layout view, click the Confine Off and the Flex Off buttons in the toolbar. 2. Click the Text tool in the tool palette.

3. Draw a rectangle above the two fields F_ENAME and F_JOB to create a new

boilerplate text object. 4. Click in the boilerplate text object, and type No detail records retrieved.

5. Select the text, then choose Format Font.

6. In the Font dialog box, choose Arial, then click OK.

7. While the Paper Layout view still displays, click the Object Navigator and position the two windows so that you can see them side-by-side.

8. In the Object Navigator, navigate to M_G_DEPTNO1_GRPFR, and select these

objects using CTRL-click: ■ R_G_DEPTNO1 F_ENAME Tip: If you receive errors when compiling, compare your code against the code provided. You can also simply copy and paste the code from suppresslabels_code.txt. Note: To adjust the way the boilerplate objects display in your resulting report, you must turn off Confine and Flex modes before you create the objects. 21-8 Oracle Reports Users Guide to Building Reports ■ F_JOB Your Object Navigator should look like this: Figure 21–6 Selected objects in the Object Navigator

9. In the Paper Layout view, click the Confine On button in the toolbar.

10. Choose Layout Bring to Front.

By choosing this menu option, Reports Builder will display the records in front of the boilerplate text you just created. If there are no records, the boilerplate text will display. The Object Navigator should now look like this: Note: If this menu option is greyed out, click the title bar of the Paper Layout view, but do not click on the canvas itself. This menu option is only available when the Paper Layout view is active.