Business Case:
Value prompt is widely used in Report Studio Reports. Users want to display a message in the prompt or display a name different from the parameter name or remove the parameter name.
Environment: IBM Cognos 8.4.1, Internet Explorer/Mozilla Firefox, Javascript.
Here's how my value prompt looks like by default:
Example 1:
In the country prompt, the parameter name is "p_country" or "country", but user wants to display "Please select a Country". User also wants to remove the dummy option with "--------".
Code:
Now the prompt looks like this:
Example 2:
User wants to remove both the name and the "-------" options from the value prompt (the first two entries). The prompt should contain only the values.
Code:
This script removes the first two options and makes the prompt look like:
Implementation:
Value prompt is widely used in Report Studio Reports. Users want to display a message in the prompt or display a name different from the parameter name or remove the parameter name.
Environment: IBM Cognos 8.4.1, Internet Explorer/Mozilla Firefox, Javascript.
Here's how my value prompt looks like by default:
Example 1:
In the country prompt, the parameter name is "p_country" or "country", but user wants to display "Please select a Country". User also wants to remove the dummy option with "--------".
Code:
<script>
//Get a list of elements on the page with "select" tag
var value_prompt = document.getElementsByTagName("select");
//Loop through the elements
for(var i=0;i<value_prompt.length;i++)
{
//Check if element is a value prompt
if(value_prompt[i].className = "clsSelectControl pv")
{
value_prompt[i].options[0].text = "Select a Page Type";
}
}
</script>
Now the prompt looks like this:
Example 2:
User wants to remove both the name and the "-------" options from the value prompt (the first two entries). The prompt should contain only the values.
Code:
<script>
//Get a list of elements on the page with "select" tag
var value_prompt = document.getElementsByTagName("select");
//Loop through the elements
for(var i=0;i<value_prompt.length;i++)
{
//Check if element is a value prompt
if(value_prompt[i].className = "clsSelectControl pv")
{
// Remove the first two options
value_prompt[i].remove(0);
value_prompt[i].remove(0);
}
}
</script>
This script removes the first two options and makes the prompt look like:
Implementation:
- On the prompt page, create an HTML item at the end of the page after all the prompts.
- Place the code above in the HTML item.
- You can change the value of [i] to customize the prompt of your choice. For example, if there are multiple value prompts on the page, the code for example 2 above will remove the name and '----' for all the prompts.
---Give the world the best you have and you'll get kicked in the teeth.
Give the world the best you have anyway.---