Collecting Select & Search prompt values

Some reports collect prompt values that are based on search criteria that are specified by the report user. An example of such a report is Public Folders > Samples > Models > GO Data Warehouse (query > SDK Report Samples > Search Prompt Product.

If you use the IBM Cognos prompt user interface,IBM®Cognos® you see the following prompt page.

Figure 1. Select & Search prompts request
This image shows the prompt page that is described here.

After you type keywords into the search box, the selected keywords are submitted to the IBM Cognos Analytics server and the Choice list box is populated with all possible values that match one or more of the keywords. The values that you choose from the list box are submitted to the server when you click Finish and can then be retrieved as with any other prompted report.

If you are collecting prompts with an alternative interface, the response from the reportPrompts resource type (REST application) or the getReportPrompts method call (SOAP application) is an LDX file that contains the following snippet.

<item>
 	<p_srch>
 		<id>_P288725932</id>
 		<ref>R5</ref>
 		<style>S5</style>
 		<pname>product</pname>
 		<rows>5000</rows>
 		<mtchany>false</mtchany>
 		<mtchall>false</mtchall>
 		<showopt>false</showopt>
 		<cname>Product</cname>
 	</p_srch>
</item>

Use the reprompt secondary request to submit search values and other parameters. For example, by using the REST interface you can submit

<gateway>/rds/sessionOutput/conversationID/<conversation_ID>
/reprompt?v=3&srchval=edge&swsID=_P288725932&pname=product
&nocase=true&mtchAny=true

to use edge as the search keyword. A portion of the response is shown here.

<item>
 	<p_srch>
 		<id>_P288725932</id>
 		<ref>R6</ref>
 		<style>S6</style>
 		<pname>product</pname>
 		<rows>5000</rows>
 		<mtchany>true</mtchany>
 		<mtchall>false</mtchall>
 		<showopt>false</showopt>
 		<srchval>edge</srchval>
 		<cname>Product</cname>
 		<selOptions>
 			<sval>
 				<use>Bear Edge</use>
 				<disp>Bear Edge</disp>
 			</sval>
 			<sval>
 				<use>Bear Survival Edge</use>
 				<disp>Bear Survival Edge</disp>
 			</sval>
 			<sval>
 				<use>Double Edge</use>
 				<disp>Double Edge</disp>
 			</sval>
 			<sval>
 				<use>Edge Extreme</use>
 				<disp>Edge Extreme</disp>
 			</sval>
 			<sval>
 				<use>Single Edge</use>
 				<disp>Single Edge</disp>
 			</sval>
 		</selOptions>
 	</p_srch>
</item>

You can reprompt again with a different search string to collect different prompts or use one of returned values and run the report.

REST example

Submit the following URL to the Cognos Analytics server:


http://localhost/ibmcognos/bi/v1/disp/rds/reportPrompts
/report/i4C970FA60C364BB0AB24A832F034A886?v=3

The response is an LDX page containing information about the prompt, in this case, the comparison country. Note the URL associated with the response page:


http://localhost/ibmcognos/bi/v1/disp/rds/sessionOutput
/conversationID/i689320782E8D45B1A4A18A9D4144504B?v=3

In order to get the search values that match the keyword edge, submit the following URL, using the reprompt secondary request.


http://localhost/ibmcognos/bi/v1/disp/rds/sessionOutput/conversationID/
i689320782E8D45B1A4A18A9D4144504B/v=3&reprompt?
srchval=edge&swsID=_P288725932&pname=product&nocase=true&mtchAny=true

The response is an LDX page containing the search terms that match the keyword edge. To select the search result Bear Edge, submit the following URL:


http://localhost/ibmcognos/bi/v1/disp/rds/sessionOutput/conversationID/
i689320782E8D45B1A4A18A9D4144504B/forward?v=3&
p_product=Bear Edge

The response from the Cognos Analytics server is a promptAnswers response that you can use to submit to run the report for the Bear Edge product category.

SOAP example

For an example of using select & search prompts in SOAP applications, see the SearchPromptValue Java and C# sample programs.