Create a Parameter Form in HTML

42-6 Oracle Reports Users Guide to Building Reports option value=1aoption select Since the LOV is currently static, we need to change this HTML element to dynamically retrieve data based on our data model. 3. In the Web Source view, modify the above code so that it looks like the following: select name= p_department rw:foreach id=fn src=G_department_name option value=rw:field id=f_deptId src=department_idrw:field id=deptname1 src=department_nameoption rw:foreach select 4. Save your report. Examine the JSP elements in the code: By using JSP tags for Oracle Reports in the above code, we retrieve data into the Parameter Forms LOV by basing the parameters on fields in the data model. Let us examine each element: ■ option: The display name of the LOV is replaced by the field department_ name from the data model. When the user displays the Parameter Form, the department name will display in the list. ■ rw:field: This element accesses each element of the g_department_name group. ■ rw:foreach: This element iterates through the results based on the g_ department_name group in the data model. ■ src: This parameter is used in both rw:foreach and rw:field elements. For the rw:foreach element, src must match the group name of the data model G_department_name. For the rw: field element, it must match the field that is referred department_name. ■ id: This parameter can be any value, but it must be unique. This parameter also applies to both rw:foreach and rw:field elements. By making these modifications to the code, we have replaced the return value attribute of the LOV with the field department_id, based on the data model we created in the previous section. If we now choose a department name from the list of values, its related department ID is returned. Note that the return value is not displayed. Note: In the above code, the LOV returns a static value. The display name is a and the value is 1. Note: You can either type the code manually or copy and paste it from the provided file called simplejsppf_code.txt. Note: For more infomation on these JSP elements and their parameters, refer to the Oracle Reports online Help. Building a Simple Parameter Form for a JSP-based Web Report 42-7

42.3.3 Run the Parameter Form report to the Web

Now that we have modified and examined our Web source, let us view the Parameter Form in a Web browser.

1. Click the Run Web Layout button in the toolbar.

2. The Parameter Form displays in your Web browser, and should look like the

following: Figure 42–5 Parameter form with values

3. Click the Department list and notice how the list is now populated with

department names. Although you can click Run Report, nothing will happen because we have not yet defined an action for it.

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. Note: If Netscape 7.0 is your default browser, and the browser does not display, set the registry key HKEY_CURRENT_ USERS\Software\Oracle\Toolkit\Tkbrowser to the default browser location. Ensure that the BrowserName and the BrowserPath keys reflect the correct values. For example: BrowserName=Netscape 7; BrowserPath=C:\Program Files\Netscape\Netscape\Netscp.exe. Note: In the modified Parameter Form, notice how the list of values for the Department has changed from a to Accounting.