Supplying Parameter Values to External Reports
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.
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.
-
From
the Insert menu, select Controls, then click Push
Button.
The cursor changes into a crosshair.
-
Drag
the crosshair to create a push button and adjust it to the size
you want.
-
Right-click
the button and select Create hyperlink.
The Hyperlink Properties dialog box opens.
-
Specify
the text you want to display as the hyperlink in the Display Text input
field.
-
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.
-
Enter
the external report procedure name in the Source field, or click
the browse (...) button to browse to the
procedure.
-
Optionally,
direct the output to a specific location by selecting Window or Frame in
the Target Type field.
-
Specify the Target/Template Name for the target frame or window.
-
Click OK.
The parameters for the report are automatically
added to objects in the layout and displayed in the Parameters tab.
-
From
the File menu, click Run.
-
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.
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.
-
From
the Insert menu, select Components, then
click Image.
The cursor changes into a crosshair.
-
Drag
the crosshair to position the image.
The Get source file dialog box opens.
-
Navigate
to the image using the Look in drop-down list, select the image,
and click Open.
-
Adjust
the image to the desired size and location.
-
Right-click
the image and select Create hyperlink.
The Hyperlink Properties dialog box opens.
-
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.
-
Enter
the external report procedure name in the Source field, or click
the browse (...) button to browse to the
procedure.
-
Direct
the output to a window by selecting Window in
the Target Type field.
-
Specify the Target/Template Name for the target frame or window.
-
Click OK.
The parameters for the report are automatically
added to objects in the layout and displayed in the Parameters tab.
-
From
the File menu, click Run.
-
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.
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.
-
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.
-
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.
-
Specify the text you want to display as the hyperlink in the
Display Text input field.
-
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.
-
Enter
the external report procedure name in the Source field, or click
the browse (...) button to browse to the
procedure.
-
Direct
the output to the frame you inserted by selecting Frame in
the Target Type field.
-
Select
the name of the frame you created from the Target/Template Name
drop-down list.
-
Click OK.
The parameters for the report are automatically
added to objects in the layout and displayed in the Parameters tab.
-
From
the File menu, click Run.
-
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.
- From the Insert
menu, select Controls, then click Push
Button.
The cursor changes into a crosshair.
- 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.
- Right-click
the button, and select Create hyperlink.
The
Hyperlink Properties dialog box opens.
- Type Run
report in the Display Text input field.
- 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.
- Enter the external
report procedure name in the Source field, or click the browse
(...) button to browse to the procedure.
- In the Target
Type field, select Window from the drop-down list.
- In the Target/Template
Name field, select New window frame from
the drop-down list.
- Click OK.
The
parameters for the first report are automatically added to objects
in the layout and displayed in the Parameters tab.
- From the Insert
menu, select Components, then click Frame.
Drag the crosshair to create a frame and adjust it to the size you
want.
- Double-click
the Name field in the Properties tab of the Properties window and
enter frame1.
- 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.
- Type Run
report 2 in the Display Text input field.
- 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.
- Enter the external
report procedure name in the Source field, or click the browse
(...) button to browse to the procedure.
- In the Target
Type field, select Frame from the drop-down list.
- In the Target/Template
Name field, select the name of the frame you created (frame1).
- Click OK.
- From the File
menu, select Run.
- 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.
- 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.
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.
-
Using Report Painter in
the Data Servers area of Developer Studio, create a procedure
using the car Master File.
-
Print the COUNTRY, CAR, DEALER_COST, and RETAIL_COST fields.
-
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.
-
Save and
close the procedure.
-
Create
a new HTML file named pass_on_url.htm.
-
In the HTML
file, create a new report.
-
Right-click
the report frame and select Reference existing procedure.
The Get source file dialog box opens.
-
Select the
procedure you created in step 1.
The New Parameters dialog box opens, as shown in the following image.
-
Click Cancel.
The page now has a report that requires a parameter but
has no parameter value supplied.
-
Click Save,
to save the HTML file.
-
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.
-
Press the
Enter key.
The report runs for the value of ITALY, as shown in the
following image.
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.
-
Create a
new HTML file named pass_on_page.htm.
-
In the HTML
file, create a List Box, as described in How to Add a List Box.
-
Select the Parameters tab
at the bottom of the HTML Composer window.
-
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.
-
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.
-
Bind listbox1
to Parameter1, as shown in the following image.
-
Select listbox1 and
perform the following actions.
-
In the Properties and settings dialog box, select the Dynamic option.
-
Click the procedure ellipsis button (...) and
select car.mas.
-
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.
-
Select the Design tab
at the bottom of the HTML Composer window.
-
In the HTML
file, create a new Push Button.
-
Right-click
the button and select Create Hyperlink.
The Hyperlink Properties dialog box opens, as shown in
the following image.
-
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.
-
While still
in the Hyperlink Properties dialog box, click Additional
parameters.
A small window opens, containing only Parameter1, as shown
in the following image.
-
Double-click Parameter1.
The window closes.
This step tells HTML Composer
that Parameter1 should be passed on the hyperlink.
-
Click OK in
the Hyperlink Properties dialog box.
-
Run the
page.
-
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.