IBM Support

Optional Prompt is displayed with check box checked by default.

Troubleshooting


Problem

When you create a Date prompt in a Report Studio and make it optional, the check box that appears with the prompt will be checked by default and users will need to uncheck it if they do not want the filter applied. Being an optional prompt, it may be preferable to have the check box uncheked by default.

Symptom

If users running the report do not un-check the prompt (since it is optional) they will get back filtered data.

Cause

Product functionality. Enhancement request have been placed.

Resolving The Problem

Insert an HTML item into the prompt page and place it on the right of the prompt. Double click on this item and insert the following Javascript code:


<SCRIPT TYPE="text/javascript">
function init()
{
// need to find all the checkboxes on the page for the date prompt
// and set to false
var node_list = document.getElementsByTagName('input');
for (var i = 0; i < node_list.length; i++)
{
var node = node_list[i];
if (node.getAttribute('type') == 'checkbox')
{
// find the dateselection checkbox chkAnyValue
var currentCheckBox = node.name;
if (currentCheckBox.indexOf("chkAnyValue")!= -1 )
{
node.checked=false;
if (node.fireEvent)
{
// IE, IE is not changing the value of the checkbox
// when calling the event.
node.fireEvent("onclick");
}
else if (node.dispatchEvent)

{
// Firefox, calling this event would change the value
// of the checkbox. You might need to set it to true
// first.
var e = document.createEvent("MouseEvents")
e.initEvent("click", true, true);
node.dispatchEvent(e);
}
}
}
}
}
init();
</SCRIPT>

Click OK. When running the report the Check box will be disabled by default.

Note: This solution must be implemented on a report-by-report basis.

Disclaimer: This is a customization to a report that is not guaranteed to work if the report is upgraded to a future release of the product. As such, this solution is not supported.

[{"Product":{"code":"SSEP7J","label":"Cognos Business Intelligence"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Report Studio","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"10.2;10.2.1;10.2.1.1;10.2.2","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
23 June 2018

UID

swg21408000