IBM Support

How to resize Select and Search or Value prompts to accommodate the width of the contained data

Troubleshooting


Problem

By default, the Select & Search and Value prompts have a fixed width which may hide portions of the search results. This document describes how to widen the Select & Search and Value prompts to accommodate the width of the contained data.

Symptom

Select & Search and Value prompts have a fixed width which may hide portions of the search results

Resolving The Problem


IBM Cognos 8 BI 8.2 and IBM Cognos 8 BI 8.3 SP2+ and IBM Cognos 8 BI 8.4

Auto-resizing may be enabled by editing a file on all gateway machines.

Note: When using Internet Explorer and if your report contains multiple prompt pages, the first prompt page automatically resizes the prompts (all prompts, search and select to the common multi-select list prompt). Any prompts on later prompt pages do not automatically resize. This change only works for the first prompt page (APAR PK88446).

Steps:
    1. On all gateway machines, open the <c8>/webcontent/prompting/properties.js file in a text editor
    2. Ensure that the following variable is set:

      var SYSTEMPROPERTY_CSEARCH_AUTO_RESIZE_RESULT_LIST = true;
    3. When using an Application Server other than Tomcat (default), you may need to deploy a new WAR File.
    4. After the change, make sure to restart the web server and clean the browser cache as well so that cached content is removed.

IBM Cognos 8 BI 8.1

Specify the width of the Search & Select and Value prompts using an HTML item containing Javascript.

Note: This is a Javascript solution. While it has been tested in IBM Cognos 8 BI 8.1 MR1 and MR2, there is no guarantee that it will function in subsequent versions of Cognos 8. As such, the recommended solution is to upgrade to the current version of IBM Cognos 8 BI, and this solution should be considered a temporary measure, rather than a long-term solution.

Steps:
    1. Ensure that the Search/Select prompt has a name. This is the last property of the prompt, under the Miscellaneous heading.
    2. Add an HTML Item
      • Add an HTML Item immediately after the Select and Search prompt. It should include the following HTML:

        <script>
        el = document.forms["formWarpRequest"].elements["_sws_<parameter name>_selectChoices<prompt name>"];
        el.style.width=500;
        </script>


        For example:

        <script>
        el = document.forms["formWarpRequest"].elements["_sws_Parameter1_selectChoicesSearchSelectPrompt"];
        el.style.width=500;
        </script>
      • For Value Prompts: Add an HTML Item immediately after the Value prompt. It should include the following HTML:

        <script>
        document.forms[0].elements["_oLstChoices<parametername>"].style.width=<number>
        </script>


        To make the value prompt smaller, either remove option 1 (the --------) or set the value for option 1 to a smaller text item by adding the following line of code to the script:

        document.forms[0].elements["_oLstChoices<parametername>"].options[1].text="---"
    3. Multi-select only

      Multi-select Search & Select prompts have two fields, both of which must be widened. Steps 1 and 2 will widen the right-side prompt. Add the following two lines between the <script> tags to increase the width of the left-side prompt:

      el = document.forms["formWarpRequest"].elements["_searchResults<prompt name>"];
      el.style.width=500;

In the examples above, change the value of 500 to another number to increase or decrease the width.

See the attached report specification example from GO Sales that widens the Search & Select prompt to 500 pixels. It has been tested with both Internet Explorer and Firefox.

NOTE for 10X:
In Some cases it has been reported the above solution does not work, mainly in the 10.X versions of Cognos BI. The following is a workaround that has been tested successfully as an alternative. There is no technical support for this solution and should be employed with this in mind if any adverse outcomes are experienced. Development has no Plans to fix this but may consider including the ability to auto size search & select prompt in a future release of Cognos Analytics. Customers are encouraged to log an Enhancement and vote to help prioritize such requests:
https://ibm.biz/IBM-Data-and-AI-Ideas

Put three HTML Items around the Search & Select prompt, two on the left, one on the right. I call them html1, html2 and html3. Put the following text into html1, html2 and html3.

html1:

<script language="javascript">
function resizeSS(prmt_id)
{
var eleTg1 = document.getElementById(prmt_id);
var selectObject = null;

if (eleTg1 && eleTg1 != undefined)
{selectObject = eleTg1.getElementsByTagName('SELECT');
if (selectObject[0] && selectObject[0] != undefined)
{selectObject[0].style.width = 'Auto';}
if (selectObject[1] && selectObject[1] != undefined)
{selectObject[1].style.width = 'Auto';}
}
}
</script>


html2:

<div id="myPrompt">

html3:

</div>
<script language="javascript">
resizeSS('myPrompt');
</script>


Now both Search & Select boxes are automatically resized.

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

Historical Number

1027039

Document Information

Modified date:
19 January 2023

UID

swg21341018