IBM Cognos Web Services Developer Guide  7.5.0
Customizing Impromptu Web Reports >

Change the Report Output Format

As the report author for the Great Outdoors sales division, your manager asks you to change the output format for a report to HTML. She wants to be able to customize the report later.

The IBM Cognos Web Services SDK application is currently using the default format specified in Upfront, which is PDF. To create an HTML version of the report, you must first obtain the report data as XML and then apply a stylesheet that formats it as HTML.

Note: Some screen images may not appear exactly as shown.

Steps
  1. Start the Test Studio .

  2. On the Extensible Applications page, click Reporting and then open the sample named Prompt and Run.

  3. If prompted, in the User ID box, type administrator and then click Log On.

  4. In the Productline box, click Golf Equipment, and then click Get Report.

    Leave Get Prompt Values cleared.

    The sales report for Belgium opens in PDF format because this is the default format defined in Upfront.

    Before you make a permanent change to the report format, you will test the XML response and ensure the data is available.

  5. In the Command box of the Send tab, add the attribute Format="XML" to the GetData command so that the entire command reads as follows:

    <SetPromptValue Action="Replace" 	Name="Main_20Query_5FProductline"
    	Value="Golf Equipment|~|Golf Equipment"/> <GetData Action="Run" 
    Format="XML" Option="Wait"/>

    Tip: This command is case-sensitive. Type it exactly as shown.

  6. In the Translator box, type iwr01.

    This changes the stylesheet used for the report.

  7. Click Send.

    The report data comes back as HTML.

    Tip: Click the XML tab to see the data returned from the adaptor. This data is then formatted as HTML by the stylesheet iwr01.xslt.

    Next, you will add the XML format permanently to the stylesheet that creates the output.

  8. In a text editor, open the promptmeta.xslt file.

    This file is located in the following directory:

    installation_location/tomcat/webapps/xts/WEB-INF/templates/cws/iwr

    The promptmeta.xslt file gets the prompt information that you enter when opening the report. It contains a reference to another stylesheet to format the final report output.

  9. In the file, search for the following JavaScript code:

    //document.IWRFormData.s.value = "iwr01";

    This code string is one of two commands that specify a translator. The JavaScript code uses the substitution parameter, s , to specify the translator:

    // Change the stylesheet to be able to view the report.
    	document.IWRFormData.s.value = "iwroutput";
    // Uncomment the following line to change the 	translator
    to be iwr01.
    //document.IWRFormData.s.value = "iwr01";

    For information about substitution parameters, see The IBM Cognos Web Services Request Language.

  10. Delete the comment // tags from the second FormData command so that it reads as follows:

    document.IWRFormData.s.value = "iwroutput";

    This second stylesheet (iwr01) now takes precedence over the previous reference to iwroutput. If the browser encounters two or more references to the same command in a stylesheet, it reads only the last one.

  11. Save the promptmeta.xslt file.

  12. Click Refresh.

    Again, the report appears in HTML format.

    Tip: When changing stylesheets (.xslt files), using the Refresh button updates the application with the changes. When changing .htm pages, you must use the Home button and open the application or report again.