Supplying Parameter Values to External Reports

How to:

You can supply parameters to external reports the same way you apply them to reports created with Report Painter. The HTML page can also contain multiple reports associated with a common set of parameters. Launch mechanisms such as a push button, hyperlink, or image can be associated to external reports that contain different sets of parameters. You can also update and target parameters for an external report to a frame or window directly within your HTML page.

Before you can supply parameter values to an external report, you must create a hyperlink to the report and associate a launch mechanism to it. After you associate a launch mechanism, such as a push button, hyperlink, or image, to the external report, the report layout is populated with the parameters.


Top of page

x
Procedure: How to Supply Parameter Values to External Reports With a Push Button

In this procedure, you will create a push button to launch an external report and target the output to a window.

  1. From the Insert menu, select Controls, then click Push Button.

    The cursor changes into a crosshair.

  2. Drag the crosshair to create a push button and adjust it to the size you want.
  3. Right-click the button and select Create hyperlink.

    The Hyperlink Properties dialog box opens.

  4. Specify the text you want to display as the hyperlink in the Display Text input field.
  5. To set the action of the hyperlink to execute an external report, select the New button, then select External procedure from the Action drop-down list.
  6. Enter the external report procedure name in the Source field, or click the browse (...) button to browse to the procedure.
  7. Optionally, direct the output to a specific location by selecting Window or Frame in the Target Type field.
  8. Specify the Target/Template Name for the target frame or window.
  9. Click OK.

    The parameters for the report are automatically added to objects in the layout and displayed in the Parameters tab.

  10. From the File menu, click Run.
  11. Click the push button to view the external report.

    The report opens in a separate window as you specified in the Hyperlink Properties dialog box for that push button.


Top of page

x
Procedure: How to Supply Parameter Values to an External Report With an Image

In this procedure, you will insert an image that will launch an external report when you click it. You will target the output to a window.

  1. From the Insert menu, select Components, then click Image.

    The cursor changes into a crosshair.

  2. Drag the crosshair to position the image.

    The Get source file dialog box opens.

  3. Navigate to the image using the Look in drop-down list, select the image, and click Open.
  4. Adjust the image to the desired size and location.
  5. Right-click the image and select Create hyperlink.

    The Hyperlink Properties dialog box opens.

  6. To set the action of the hyperlink to execute an external report, select the New button, then select External procedure from the Action drop-down list.
  7. Enter the external report procedure name in the Source field, or click the browse (...) button to browse to the procedure.
  8. Direct the output to a window by selecting Window in the Target Type field.
  9. Specify the Target/Template Name for the target frame or window.
  10. Click OK.

    The parameters for the report are automatically added to objects in the layout and displayed in the Parameters tab.

  11. From the File menu, click Run.
  12. Click the image to view the external report.

    The report opens in the window you specified in the Hyperlink Properties dialog box for that hyperlink.


Top of page

x
Procedure: How to Supply Parameter Values to an External Report With a Hyperlink

In this procedure, you will create a frame and target report output from an external report to it. You will also create a hyperlink to launch the external report.

  1. From the Insert menu, select Components, then click Frame. Drag the crosshair to create a frame and adjust it to the size you want. Enter a name for the frame by double-clicking the Name field in the Properties tab of the Properties window.
  2. From the Insert menu, select Components, then click Hyperlink. Drag the crosshair to create a hyperlink and adjust it to the size you want.

    The Hyperlink Properties dialog box opens.

  3. Specify the text you want to display as the hyperlink in the Display Text input field.
  4. To set the action of the hyperlink to execute an external report, select the New button, then select External procedure from the Action drop-down list.
  5. Enter the external report procedure name in the Source field, or click the browse (...) button to browse to the procedure.
  6. Direct the output to the frame you inserted by selecting Frame in the Target Type field.
  7. Select the name of the frame you created from the Target/Template Name drop-down list.
  8. Click OK.

    The parameters for the report are automatically added to objects in the layout and displayed in the Parameters tab.

  9. From the File menu, click Run.
  10. Click the hyperlink to view the external report.

    The report opens in the frame you specified in the Hyperlink Properties dialog box for that hyperlink.



Example: Supplying Parameter Values to Multiple External Reports

In this example, you will add two reports to a layout. You will associate a push button to one report and target the output to a window. You will associate a hyperlink to the second report and target the output to a frame.

  1. From the Insert menu, select Controls, then click Push Button.

    The cursor changes into a crosshair.

  2. Drag the crosshair to create a push button and adjust it to the size you want.

    A push button is created in the layout and assigned the name button(n), where n is a number.

  3. Right-click the button, and select Create hyperlink.

    The Hyperlink Properties dialog box opens.

  4. Type Run report in the Display Text input field.
  5. Set the action of the hyperlink to execute a report by clicking the New button and selecting External procedure from the Action drop-down list.
  6. Enter the external report procedure name in the Source field, or click the browse (...) button to browse to the procedure.
  7. In the Target Type field, select Window from the drop-down list.
  8. In the Target/Template Name field, select New window frame from the drop-down list.
  9. Click OK.

    The parameters for the first report are automatically added to objects in the layout and displayed in the Parameters tab.

  10. From the Insert menu, select Components, then click Frame. Drag the crosshair to create a frame and adjust it to the size you want.
  11. Double-click the Name field in the Properties tab of the Properties window and enter frame1.
  12. From the Insert menu, select Components, then click Hyperlink. Drag the crosshair to create a hyperlink and adjust it to the size you want.

    The Hyperlink Properties dialog box opens.

  13. Type Run report 2 in the Display Text input field.
  14. Set the action of the hyperlink to execute a report by clicking the New button and selecting External procedure from the Action drop-down list.
  15. Enter the external report procedure name in the Source field, or click the browse (...) button to browse to the procedure.
  16. In the Target Type field, select Frame from the drop-down list.
  17. In the Target/Template Name field, select the name of the frame you created (frame1).
  18. Click OK.
  19. From the File menu, select Run.
  20. Click the push button to view the first external report.

    The report opens in a separate window as specified in the Hyperlink Properties dialog box for that push button.

  21. Click the hyperlink to view the second external report. The report opens in the frame you specified in the Hyperlink Properties dialog box for that hyperlink.


Top of page

x
Procedure: How to Supply a Parameter Value to a Report Using a URL

In this procedure, you will create a report within an HTML page where you can pass a parameter to the report, directly from a URL.

  1. Using Report Painter in the Data Servers area of Developer Studio, create a procedure using the car Master File.
    1. Print the COUNTRY, CAR, DEALER_COST, and RETAIL_COST fields.
    2. Assign the COUNTRY field to a parameter named Parameter1.

    For more information on creating a report using Report Painter, see the Creating Reports With Report Painter manual.

  2. Save and close the procedure.
  3. Create a new HTML file named pass_on_url.htm.
  4. In the HTML file, create a new report.

  5. Right-click the report frame and select Reference existing procedure.

    The Get source file dialog box opens.

  6. Select the procedure you created in step 1.

    The New Parameters dialog box opens, as shown in the following image.

  7. Click Cancel.

    The page now has a report that requires a parameter but has no parameter value supplied.

  8. Click Save, to save the HTML file.
  9. Type the following into the address bar of a new web browser window:
    http://localhost:8080/approot/appname/pass_on_url.htm?Parameter1=ITALY

    where:

    appname

    Is the name of the application that contains the HTML page.

    Parameter1=ITALY
    Sets Parameter1, which had no previous value, to ITALY.
  10. Press the Enter key.

    The report runs for the value of ITALY, as shown in the following image.


Top of page

x
Procedure: How to Pass a Parameter From One Page to Another

In this procedure, you will create an HTML file that contains a list box and a button. The HTML file can pass a parameter from one webpage to another.

Note: You will use the file, pass_on_url.htm, created in the procedure How to Supply a Parameter Value to a Report Using a URL. This is the webpage to which the parameter will be sent.

  1. Create a new HTML file named pass_on_page.htm.
  2. In the HTML file, create a List Box, as described in How to Add a List Box.
  3. Select the Parameters tab at the bottom of the HTML Composer window.
  4. Right-click and select Add parameter.

    A new parameter is added to the HTML file. This parameter is named Parameter1 by default, as shown in the following image.

  5. Click the newly created Parameter1 and in the Properties and settings dialog box, type A10 in the Format field.

    A10 is the format of COUNTRY, the field used in pass_on_url.htm.

  6. Bind listbox1 to Parameter1, as shown in the following image.

  7. Select listbox1 and perform the following actions.
    1. In the Properties and settings dialog box, select the Dynamic option.
    2. Click the procedure ellipsis button (...) and select car.mas.
    3. Click the ellipsis button (...) for the Value field. Populate listbox1 with the COUNTRY field.

    The Properties and settings dialog box for listbox1 will look similar to the following image.

  8. Select the Design tab at the bottom of the HTML Composer window.
  9. In the HTML file, create a new Push Button.
  10. Right-click the button and select Create Hyperlink.

    The Hyperlink Properties dialog box opens, as shown in the following image.

  11. Create a new hyperlink with the following properties.
    • Action set to HTML File.
    • Source set to the file, pass_on_url.html, which was created in the previous procedure.
    • Target Type set to Window.
    • Target/Template Name set to New window.

    The new hyperlink settings are shown in the following image.

  12. While still in the Hyperlink Properties dialog box, click Additional parameters.

    A small window opens, containing only Parameter1, as shown in the following image.

  13. Double-click Parameter1.

    The window closes.

    This step tells HTML Composer that Parameter1 should be passed on the hyperlink.

  14. Click OK in the Hyperlink Properties dialog box.
  15. Run the page.
  16. Select ENGLAND from the list box and click the button, as shown in the following image.

    The report runs, showing the records for ENGLAND, as shown in the following image.

    The value was passed from the first page to the second page.


WebFOCUS