IBM Support

Changing the default behavior of the 'Search and Select' Prompt

Question & Answer


Question

The Search and Select prompt control provides great flexibility in prompting. It can perform the following searches for prompt values: (1) Starts with any of these keywords (2) Starts with the first keyword, and contains all of the remaining keywords (3) Contains any of these keywords (4) Contains all of these keywords. Option (1) is the default choice.

Cause

There is no prompt control property available to set which option is applied by default.

Answer

This technique uses JavaScript to control the default behaviour of the Search and Select control, the technique below works for Cognos 10.2.1

Ad an HTML Item code before the Prompt with this code
<div id="MonSns">
Add second HTML Item code after the prompt with this code
</div>
<script>
/* Select and search options
* 2 - Starts with any of these keywords * DEFAULT
* 3 - Starts with the first keyword and contains all of the remaining
keywords
* 4 - Contains any of these keywords
* 5 - Contains all of these keywords
*/
document.getElementById('MonSns').getElementsByTagName('input')[5].click();
</script>

Important: "MonSns" is the name of the prompt in the "Select & Search Prompt" properties.

[{"Product":{"code":"SSEP7J","label":"Cognos Business Intelligence"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Report Studio","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF033","label":"Windows"}],"Version":"10.2.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
15 June 2018

UID

swg21902305