Question & Answer
Question
This document describes the syntax for passing single or multiple values to a prompt in a prompted report. It also describes date range parameters and XML encoded parameters.
Answer
The IBM Cognos SDK Developer Guide for your installed version, contains examples of how to pass prompts in a URL.
This guide is only available through an SDK product installation.
Prompt values can be appended to the end of a URL by adding it to the URL string.
Add the text "&p_" in front of the parameter name (&p_ParamName).
The ParamName parameter should exist in the target report with this exact name.
The following setting should also be present: &run.prompt=false
The standard syntax for non parameterized report URL:
http://servername/ibmcognos/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/report-viewer.xts&method=execute&m_obj=%2fcontent%2fpackage%5b%40name%3d%27GO%20Sales%20and%20Retailers%27%5d%2ffolder%5b%40name%3d%27Report%20Studio%20Report%20Samples%27%5d%2freport%5b%40name%3d%27linktome%27%5d&backURL=%2fcrn%2fcgi-bin%2fcognos.cgi%3fb_action%3dxts.run%26m%3dportal%2fcc.xts%26m_path2%3d~%252ffolder%26m_path%3d%252fcontent%252fpackage%255b%2540name%253d%2527GO%2520Sales%2520and%2520Retailers%2527%255d%252ffolder%255b%2540name%253d%2527Report%2520Studio%2520Report%2520Samples%2527%255d
In order to add the value 1153 for the parameter called OrderNum, append the string: &p_OrderNum=1153 to the report URL as follows:
http://servername/ibmcognos/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/report-viewer.xts&method=execute&m_obj=%2fcontent%2fpackage%5b%40name%3d%27GO%20Sales%20and%20Retailers%27%5d%2ffolder%5b%40name%3d%27Report%20Studio%20Report%20Samples%27%5d%2freport%5b%40name%3d%27linktome%27%5d&backURL=%2fcrn%2fcgi-bin%2fcognos.cgi%3fb_action%3dxts.run%26m%3dportal%2fcc.xts%26m_path2%3d~%252ffolder%26m_path%3d%252fcontent%252fpackage%255b%2540name%253d%2527GO%2520Sales%2520and%2520Retailers%2527%255d%252ffolder%255b%2540name%253d%2527Report%2520Studio%2520Report%2520Samples%2527%255d&p_OrderNum=1153
To use multiple parameter values, the URL parameter can be duplicated for each consecutive value.
To use a range of values, the syntax is &p_OrderNum=1153:1160.
This functionality is dependent on the type of parameter in the report, and for this to work correctly, the parameter should support multiple values.
Optional Filters:
If the report contains optional filters, the URL should contain an empty value for the optional prompt names:
http://servername/ibmcognos/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/report-viewer.xts&ui.action=run&ui.object=%2fcontent%2fpackage%5b%40name%3d%27New%20Package%27%5d%2freport%5b%40name%3d%27urlreport%27%5d&run.outputFormat=HTML&p_City=London&p_Title=&run.prompt=false
In the above example, Title is an optional filter in the URL. It is set to nothing: &p_Title=
Without all the optional filters satisfied in the URL, the prompt page may still be displayed (version dependent).
Further Examples:
To pass multiple values, an XML encoded format can be used (since version 8.3).
p_ParamName=
<selectChoices>
<selectOption useValue="1"/>
</selectChoices>
URL Sample:
http://ServerName/ibmcognos/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/report-viewer.xts&method=execute&m_obj=%2Fcontent%2Fpackage%5B%40name%3D%27GO%20Sales%20Information%27%5D%2Freport%5B%40name%3D%27promptSample%27%5D%20%0D&p_ParamName=%3CselectChoices%3E%0D%20%20%20%20%3CselectOption%20useValue%3D%221%22%2F%3E%0D%20%20%20%20%3CselectOption%20useValue%3D%222%22%2F%3E%0D%20%20%20%20%3CselectOption%20useValue%3D%223%22%2F%3E%0D%3C%2FselectChoices%3E&prompt=false
Multiple Values:
<selectChoices>
<selectOption useValue="1"/>
<selectOption useValue="2"/>
<selectOption useValue="3"/>
</selectChoices>
Bounded Range (numeric):
<selectChoices>
<selectBoundRange selected="true">
<start displayValue="1" useValue="1"/>
<end displayValue="4" useValue="4"/>
</selectBoundRange>
</selectChoices>
Date equal:
<selectChoices>
<selectOption useValue="1990-02-15T00:00:00.000"/>
</selectChoices>
Date Bounded Range:
<selectChoices>
<selectBoundRange selected="true">
<start useValue="1992-03-05T00:00:00.000"/>
<end useValue="1992-03-05T00:00:00.000"/>
</selectBoundRange>
</selectChoices>
The string will be encoded automatically if it is used in a single line in a supported browser address bar. Add the XML text in a single line without additional spaces to the URL.
Passing a tree Prompt parameter in the URL for Cognos :
If the report has a tree prompt based on years, and the parameter is called "pYear":
In order to run the report for the year of 2005, we should append the MUN (Member Unique name)
&p_pYear=[Sales].[Time dimension].[Time dimension].[Year]->[all].[2004] to the report URL:
The report URL can be found following these steps:
1. Click on "Set Properties" for the specific rpeort
2. Click on "View the search path, ID and URL"
The URL will be found in the "Default action URL" window
The following setting should also be changed from "&run.prompt=true" to "&run.prompt=false" in order not to be prompted when executing the URL;
http://ServerName/ibmcognos/cgi-bin/cognos.cgi?b_action=cognosViewer&ui.action=run&ui.object=%2fcontent%2fpackage%5b%40name%3d%27GO%20Data%20Warehouse%20(analysis)%27%5d%2ffolder%5b%40name%3d%27Report%20Studio%20Report%20Samples%27%5d%2freport%5b%40name%3d%27Sales%20Commissions%20for%20Central%20Europe%27%5d&ui.name=Sales%20Commissions%20for%20Central%20Europe&run.outputFormat=&run.prompt=false&p_pYear=[Sales].[Time dimension].[Time dimension].[Year]->[all].[2004]
Related Documents in IBM Developer Works :
Using URL's in Cognos 8 (PDF)
http://www.ibm.com/developerworks/data/library/cognos/page123.html
Using URLs to call IBM Cognos PowerPlay 8 Content
http://www.ibm.com/developerworks/data/library/cognos/page408.html
Passing Use and Display Values on a URL
http://www.ibm.com/developerworks/data/library/cognos/page418.html
On Line Documentation for IBMC 10.2.0 :
See Section Performing Tasks in IBM Cognos BI using URLs
http://pic.dhe.ibm.com/infocenter/cbi/v10r2m0/topic/com.ibm.swg.ba.cognos.ug_cra.10.2.0.doc/c_performing_tasks_using_urls.html
Other
Historical Number
1008673
Was this topic helpful?
Document Information
Modified date:
28 November 2022
UID
swg21338766