42.4 Set up the Target Report

Now that you have set up the parameters, the next step is to set up the target report to accept the parameters. Then, we will define the action for your Parameter Form. When a user clicks Run Report, the target report will be run based on the Department and User ID parameters.

The target report we use in this section is the sample report for the Oracle Reports Tutorial. If you completed the exercises in the Oracle Reports Tutorial and created emprevb.jsp, you can use that report in this section. Otherwise, you can use the example file we have provided, called emprev_final.jsp. We will not show the steps to build this report in this section.

For more information on building the sample JSP-based Web report, refer to the Oracle Reports Tutorial.

To set up the target report:

  1. In Reports Builder, open the file we have provided called emprev_final.jsp.

  2. In the Object Navigator, double-click the icon next to the Data Model node.

  3. In the Data Model view that displays, double-click the query (Q_1) to display the SQL Query Statement dialog box.

  4. Find the final line of the code:

    WHERE (EMPLOYEES.MANAGER_ID = EMPLOYEES_A1.EMPLOYEE_ID) 
    AND EMPLOYEES.DEPARTMENT_ID = 100
    
  5. Change the second WHERE clause so that the last line looks like this:

    WHERE (EMPLOYEES.MANAGER_ID = EMPLOYEES_A1.EMPLOYEE_ID) 
    AND EMPLOYEES.DEPARTMENT_ID = :P_DEPARTMENT
    

    Tip:

    The code we have changed is in bold text.
  6. Click OK.

  7. A note displays that indicates a bind parameter has been created. Click OK.

  8. Save your report as emprev_param_your_initials.jsp.