Create a layout for your report using the Report Wizard

Building a Report with an XML Pluggable Data Source 45-13 can enter at runtime. You will then create a hierarchy in your data model to group the data in your report. To create a user parameter and a group filter: 1. In the Object Navigator, under the User Parameters node, create a new user parameter called P_MAXQTY, with a Datatype of Number, Width of 20, and Initial Value of 50 see Section 4.11.2, Creating a user parameter . 2. In the Data Model view, double-click the G_WAREHOUSE_ID1 group in the XML query to display its Property Inspector.

3. In the Property Inspector, under Group:

■ set the Filter Type property to PLSQL. ■ click the PLSQL filter property field to display the PLSQL Editor. 4. In the PLSQL Editor, use the template to enter the following PLSQL code: function G_WAREHOUSE_ID1GroupFilter return boolean is begin if :quantity_on_hand :P_maxqty then return TRUE; else return false; end if; end;

5. Click Compile, and fix any errors.

6. When the code compiles successfully, click Close.

7. Save your report. 8. Click the Run Paper Layout button in the toolbar to run your report to paper. Notice how a Parameter Form now displays where you can adjust the quantity of items displayed in your report. You can also run the provided report inventoryreport.rdf to view the results in Reports Builder. 9. Save your report. To create a hierarchy for the XML query: 1. In the Data Model view, click the PRODUCT_ID column in the XML query, then drag it between the query name and the G_WAREHOUSE_ID1 group. Your data model should look like this: Note: You can also copy and paste this code from the provided file called xmlpds_code.txt. Copy the code under the heading Group Filter Code. Note: If you are not familiar with compiling PLSQL, refer to a PLSQL reference manual. 45-14 Oracle Reports Users Guide to Building Reports Figure 45–7 Data Model with Group Hierarchy 2. Save your report. You have now created a group hierarchy that sorts the data in your report.

45.3 Run Your Report to Paper

To run your paper report: 1. In the Object Navigator, make sure your report inventoryreport_xml_your_ initials .rdf is selected. 2. Click the Run Paper Layout button in the toolbar to run your report to paper. Notice how the Parameter Form now displays, with the initial value of 50. 3. Your report displays in the Paper Design view, and should look something like this: Note: Notice in the above image that a green circle displays above G_WAREHOUSE_ID1. This circle indicates that a group filter has been created for the group.