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

Counting # of Items Selected From a Drop Down List

Started by Wildrose, 15 Sep 2008 12:09:38 PM

Previous topic - Next topic

Wildrose

Gurus,

I have a value prompt and would like to count the number of items selected by the user after leaving the field.

What I have done is created and HTML Item before the list with this code:

<div id = "Select" onblur= (CountItems)>

After the list I have two HTML Items
</div>

and

Function CountItems()
{
   var i=0;
   var numSelected = 0;

   for (i=0; i<Select.length; i++)
   {
        if(Select.selected)
        {
             numSelected = numSelected + 1;
        }
   }

return numSelected;

alert(numSelected); 
}

</script>

The alert is just for testing. This approach is not working. I am not savy with using the HTML Items I may not be making sense in setting them up.

Can anyone help me out??

The end result is that if a user selects more than 1 items I want to display something if not keep it hidden. Once I get the count can I populate something for the variable to use?

Any help would be much appreciated.



blom0344

Wouldn't it be a bit easier to just fetch the item as well and perform a count distinct within the report?