If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Dropdown Combo with checkboxes

Started by cemuney, 24 Mar 2011 06:58:14 AM

Previous topic - Next topic

cemuney

Hi.
Is it possible to use dropdowncombo with checkboxes in Cognos 10 reporting.
like in Excel

Thanks.

ashhutch

You could try using a Tree Prompt with an 'in' option rather than an '=' option.  I have attached a screen shot of an example


cemuney

thanks ashhutch.
i already used tree prompt. There are lots of prompts in our report. (about 6)

Our customers used to have reports in Excel and SQL Reporting Services 2008. There is a dropdown listbox with multiselect.
Now they are using Cognos10 and they are hopping to see the same object in Cognos10. When we use Treeprompts the objects cover the screen and it is not user friendy.
anyway thanks again.
Cem Uney

Arpitagrawal9

  Although this functionality cannot be achieved directly by Cognos, it can be implemented with the help of JavaScript. If usage of JavaScript is allowed, then following implementation can be used to give the look of a single select prompt to a multiselect prompt.  The Multiselect Prompt here is of List Box type.
   When the user clicks on the drop down of the single select prompt shown in the report, then the corresponding multiselect prompt is seen. After selecting the various parameters from the multiselect prompt it is hidden on the click of any place in the document outside the multiselect prompt.
For example let's create a multi select prompt for selection of Product Line. Paste the following scripts in the positions mentioned as below:
1.   Place the following script in an HTML item Before the Prompt:
<SELECT name="reportDropDownPL" onclick="javascript:changePromptType(this);" readonly style="FONT-SIZE: 10pt; WIDTH: 140px; FONT-FAMILY: 'Arial';display:block">
    <OPTION VALUE="1" SELECTED >Product Line</OPTION>
/*
Note: The term before the 'DropDownPL' (of SELECT tag as above) and 'PromptPL' (Div id of multiselect prompt as below) should be same. In this case it is 'report'.
The SELECT tag here is used to make a single select prompt showing Product Line, with the help of javascript instead of the default cognos value prompt.
This will help save more space in the report.
*/
</SELECT>
<div id="reportPromptPL" style="margin:0px;padding:0px;display:none;position:absolute">
Please Note: For the single select prompt and multiselect prompt to look similar, both should be of the same width. Here, the width in SELECT tag of the above script (which acts as Single select prompt) is 140 px. Hence, define the width of the multiselect prompt as 140 px through the size and overflow option of the prompt. Also, take care to hide the adornments of multiselect prompt. Depending on the requirement, set the Required property of the prompt to 'Yes' or 'No'. It is desirable to provide the default selection to the prompt.

2.   Place the end tag for div in an HTML item After the prompt </div> 

3.   Place an HTML item at the starting i.e. before the HTML item of the starting of the Prompt and paste the script as below in it. Here, the function showHideMultiSelectPrompt along with function changePromptType is used to give a look of combo box for the prompts. It typically displays and hides the multiselect prompt on the click of single select prompt seen in the report.
<script>
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined) { fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );}

var expPromptDivName ="PL";
var expPromptName = "reportPromptPL"; //assign the div id of the multiselect prompt of report to this expPromptName variable. Here it is reportPromptPL.


// function for displaying multiselect drop down prompt --------------------------------------
function showHideMultiSelectPrompt(){
   var clickObj = event.srcElement;   
   if(clickObj && clickObj.name && clickObj.name.match('[a-z]+DropDown'+expPromptDivName )){
      var promptName = clickObj.name.match(/([a-z]+)DropDown([A-Z]{2})/)[1];
      var multiSelectPrompt = document.getElementById(promptName+'Prompt'+expPromptDivName);
      if(multiSelectPrompt.id == expPromptName){
         multiSelectPrompt.style.display = multiSelectPrompt.style.display=="none"?"block":"none";
      }else{
         multiSelectPrompt.style.display = "block";
         document.getElementById(expPromptName).style.display = "none";
         expPromptName = multiSelectPrompt.id;
      }
   }else if(clickObj && clickObj.type != 'select-multiple')
      document.getElementById(expPromptName).style.display = "none";
}

function changePromptType(oPrompt){
   if(oPrompt.multiple == false){
      oPrompt.multiple = true;
      oPrompt.multiple = false;
   }
}

document.onclick=showHideMultiSelectPrompt; //function called to hide the multiselect prompt, when clicked anywhere on the page.
</script>
4.   The above implementation does not hide the default Cognos option of 'Select all Deselect all' seen below the multiselect prompt. It is recommended to hide these options to give a better look and feel of the implementation. To hide these options you may use the following CSS script. Paste the below script in an HTML Item placed on the report.
<STYLE Type="Text/CSS">
DIV.clsPromptComponent DIV A{
   display:none;
}
</STYLE>

squish88

Just a heads up, to hide the default Cognos option of 'Select all Deselect all' seen below the multiselect prompt, you don't need a CSS or javascript of any kind.  The built in functionality to do that is here: 

Page Explorer --> Classes --> Prompt Control Hyperlink

Just set the box type to none for that class.   Saves a little on code that may need to be supported through upgrades, etc. 

Otherwise, cool solution!!  :-)

Amruta Gandhi


bmabry

Quote from: ashhutch on 28 Mar 2011 06:18:19 PM
You could try using a Tree Prompt with an 'in' option rather than an '=' option.  I have attached a screen shot of an example

I want to do this, but not sure how to get it to work. Where does the 'in' option at rather than the '='. I want it to work just the way you have it. I also need to know how to get the 'select all' and the 'deselect all' to show up, where is that at?

I am knew to cognos and can't get training in report studio until November, but still have to get this done. So, any help would be appreciated. Thanks.