To make the report more readable, you can add space between a certain number of records. To do so, you first create the parameter that determines the number of records between which the space will display. Then, you create a summary column in the data model that counts the number of records. You will then modify the paper layout of your report so that the vertical elasticity is variable. Finally, you will create a format trigger that will display the space between the user-determined number of records.
The parameter you will create in this section will determine how many records are displayed before an extra space is printed. Since this parameter is a user parameter, the user can change this value at runtime.
In the Object Navigator, under the Data Model node, click the User Parameters node.
Choose Edit > Create to create a new user parameter under the User Parameters node.
If the Property Inspector is not already displayed, right-click the new user parameter (P_1), then choose Property Inspector to display the Property Inspector, and set the following properties:
Under General Information, set the Name property to SPACE.
Under Parameter, set the Datatype property to Number, and set the Initial Value property to 5.
Note:
By giving the user parameter an initial value, the user can simply run the report without changing the parameters, and a space will display between every five records.The user parameter now displays in the Object Navigator:
Figure 40-13 User Parameter in the Object Navigator
Save your report.
In this section, you will create a summary column in the data model that counts the number of employee records. This information will then be used by the format trigger to determine where to add extra space.
In the Object Navigator, double-click the view icon next to the Data Model node to display the Data Model view.
In the Data Model view, click the Summary Column tool in the tool palette, then click in the G_FIRST_NAME group beneath the TOTAL_COMP formula column to create a new summary column:
Figure 40-14 Data Model with new summary column
Double-click the new summary column object (CS_1) to display the Property Inspector, and set the following properties:
Under General Information, set the Name property to CNT_COLUMN.
Under Summary, set the Function property to Count, and set the Source property to FIRST_NAME.
Save your report.
To allow Reports Builder to insert the vertical spacing, you must modify the layout of your report.
Click the Paper Layout button in the toolbar to display the Paper Layout view.
Click the Flex On button in the toolbar.
In the Paper Layout view, click the repeating frame associated with G_FIRST_NAME.
Note:
If you cannot find the repeating frame in the Paper Layout view, you can click R_G_FIRST_NAME in the Object Navigator. The associated repeating frame will be selected in the Paper Layout view.Click the center handle of the frame and drag the frame downward to create additional space. This additional space should be slightly larger than what you want to see between the sets of records.
With the repeating frame selected, choose Tools > Property Inspector to display the Property Inspector, and set the following properties:
Under General Layout, set the Vertical Elasticity property to Variable.
In the Paper Layout view, click the Rectangle tool in the tool palette, and draw a rectangle below the fields in the newly created space.
Make sure the new rectangle has no fill and no line so that it is not visible.
The following image shows the new layout with the invisible rectangle:
Figure 40-15 Layout with added vertical space
Save your report.
Now that you have adjusted the layout, you can create a format trigger based on the new boilerplate rectangle you created in the previous section. This format trigger will display this space after every set number of records, determined by the user parameter.
To create a format trigger on the boilerplate rectangle:
While the rectangle is selected in the Paper Layout view, press F11 on your keyboard (or choose Tools > PL/SQL Editor) to display the PL/SQL Editor.
In the PL/SQL Editor, use the template to enter the following PL/SQL code:
function B_1FormatTrigger return boolean is begin If :CNT_COLUMN mod :SPACE = 0 then return(TRUE); else return(FALSE); end if; end;
Note:
You can enter this code by copying and pasting it from the provided text file calledplsql_code.txt
. This code is for the Format Trigger.Click Compile.
When the code is compiled without errors, click Close.
Save your report.