In this section: |
You can save graph output to an image file using the GRAPHSERVURL parameter or the JSCOM3 configuration on the WebFOCUS Reporting Server. Saving graph output as an image file is useful when you want to create a single PDF or HTML report that contains multiple outputs, such as output from a TABLE request and a GRAPH request. You can distribute this type of report using ReportCaster.
For details, see Saving a Graph as an Image File Using GRAPHSERVURL.
How to: |
Reference: |
The GRAPHSERVURL parameter enables users who are running against a server environment where the WebFOCUS Reporting Server is installed on a z/OS, Windows, or UNIX machine to save graph output as a GIF file. GIF images can be embedded in a PDF or HTML report.
The GRAPHSERVURL parameter sends an http request to the machine that has the WebFOCUS Graph Servlet. The graph image is created by the WebFOCUS Graph Servlet, and the image is sent back to a temporary location on the WebFOCUS Reporting Server (if an Allocation has not been specified), or to the location specified in a FILEDEF command. You may use the Allocation Wizard to create a FILEDEF command.
SET GRAPHSERVURL=http://hostname/ibi_apps/IBIGraphServlet
where:
Is the name of the machine where WebFOCUS is installed.
For more details, see Save a Graph as an Image File.
[FILEDEF filename DISK drive:\...\filename.fmt] SET GRAPHSERVURL= graph_servlet_URL GRAPH FILE file graph commands ON GRAPH HOLD AS filename FORMAT fmt END
where:
Saves the image file to the location you specify.
Is the name you give the image file, which must match the FILEDEF command filename. If you want to prompt for a filename, include an amper variable such as &FILENAME in the procedure.
Is the type of image file in which to store the graph. Acceptable values are: PNG, SVG, GIF, or JPG.
Is the URL to invoke the WebFOCUS Graph Servlet. The maximum number of characters is 256.
Is the name of the data source you wish to report against.
Note: To insert an image that resides in a permanent location, you must provide the fully qualified path to the image file. For example, to insert a GIF file,
TYPE=REPORT, IMAGE=drive:\...\ filename.gif
where:
Is the path where the GIF file is located. The WebFOCUS Reporting server must be installed on that drive.
The following illustrates how you can create a GIF file from a graph request, and then embed the GIF image into a PDF report.
SET GRAPHSERVURL= http://localhost/ibi_apps/IBIGraphServlet GRAPH FILE CENTORD SUM LINEPRICE ACROSS PLANTLNG AS 'Plant' ON GRAPH HOLD AS PLANT FORMAT GIF END
TABLE FILE CENTORD SUM LINEPRICE BY PLANTLNG AS 'Plant' ON TABLE SET STYLE * TYPE=REPORT, IMAGE=plant.gif, POSITION=(4 0), SIZE=(5 3), $ ENDSTYLE ON TABLE PCHOLD FORMAT PDF END
Note: If you are using JSCOM3, you can eliminate the SET GRAPHSERVURL parameter from the procedure.
<HTML> <HEAD> <TITLE> Inserting a GIF Image in a PDF Report </TITLE> </HEAD> <BODY> <H4 ALIGN=CENTER>Report on Line Price by Plant</H4> <HR> <P><FONT SIZE=+2></FONT></P> <UL TYPE=SQUARE <LI><A HREF="http://localhost/ibi_apps/WFServlet?IBIF_ex=holdgif"> <H4 ALIGN=CENTER>Click Here to Launch a PDF Report with an Embedded GIF Image</H4></A> </UL> </BODY> </HTML>
The resulting launch page looks like this:
You can now run the report from a browser. To distribute the report using ReportCaster, you would schedule the actual procedure, in this case HOLDGIF, to distribute the report.
Note: To run this procedure as a Managed Reporting Standard Report, add the -MRNOEDIT command to the beginning of the StyleSheet declaration containing the IMAGE attribute. This prevents Managed Reporting from looking for the GIF file in the Managed Reporting Repository. The image that is specified must reside on the WebFOCUS Reporting Server.
The -MRNOEDIT syntax is not case-sensitive and it can be used on a single line or a block of lines. For example:
Single line
-MRNOEDIT TYPE=REPORT, IMAGE=PLANT.gif, POSITION=(4 0), SIZE=(5 3), $
or
-MRNOEDIT TYPE=REPORT, IMAGE=PLANT.gif, -MRNOEDIT POSITION=(4 0), SIZE=(5 3), $
Multiple lines
-MRNOEDIT BEGIN TYPE=REPORT, IMAGE=PLANT.gif, POSITION=(4 0), SIZE=(5 3), $ -MRNOEDIT END
If you selected the Save Report check box in the configuration pane of the WebFOCUS Administration Console (under Redirection Settings), you will be prompted whether to save or open the output file. If the procedure contained a PCHOLD command that specified an AS name for the output file, the name is retained if you choose to save the file. If no AS name was specified, a random filename is generated.
Important: You must do the following in the WebFOCUS Administration Console to utilize Save Report functionality for WebFOCUS GRAPH requests (specified with a PNG, SVG, GIF, or JPG format in the procedure):
Running a server-side GRAPH request creates an HTM file that contains a link to the actual graph output, which is stored as a temporary image file with a .jpg, .gif, .svg, or .png extension.
When you execute a GRAPH request, if you select the Save option when prompted to Open or Save the output, the output is saved to an HTM file using only a reference to the graph image, which will eventually expire and be deleted from the server (according to the temporary file expiration settings in the WebFOCUS Client Configuration).
To preserve the output of the GRAPH request, open the saved HTM file, right-click the graph image, and select Save Picture As to save it to disk permanently. You can then substitute an absolute reference to the saved image file in the returned HTM output file.