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

Cognos 10.2 remove first two options from a dropdown list

Started by adik, 08 Jan 2014 08:31:40 AM

Previous topic - Next topic

adik

Hi all,

I would like to know if there is any way to remove the first two options of a dropdown list, in Cognos 10.2, using the JavaScript API?
I know how to do this using the selection of the DOM element, but since there is an API for selecting the prompt, I want to know if there is the possibility to go that route also.

What I found was that I can get to the DOM element using the prompt API like so:
var oCR = cognos.Report.getReport("_THIS_");
var myPrompt = oCR.prompt.getControlByName("MyPrompt")._eE;

and then I can do:
myPrompt.remove(0);
myPrompt.remove(1);

This works in Cognos 10.2, but in Cognos 10.2.1 this doesn't work as the DOM element reference seems to be renamed to something like: var myPrompt = oCR.prompt.getControlByName("MyPrompt")._eL;

So is there any other way of doing this without relying of the nodes like _eE and _eL ?

MFGF

Hi,

When you refer to removing the first two options, do you mean the title and the dotted line? If so, simply go to the properties of the prompt and set the Header Text property to "Specified Text" without entering anything for the text.

If you are trying to remove the first two data values from the prompt, why not just go to the query underpinning the prompt and add a filter to remove these items from the query?

MF.
Meep!

adik

yes, i was reffering to the prompt name and the minus signs.
the header text did the trick. i didn't know they included this property as cognos 8 didn't have it and you needed javascript for that.
thanks

adik

while on the topic I have another question: how do you reach the DOM elements of a prompt using the Prompt API?
more exactly I want to add an onclick event to a value prompt (dropdown list)

navissar

Hi,
You can trigger an onchange event by using the prompt API's setValidator function. The setValidaor() function checks the prompt when it is changed (A new value is selected/old value is deselected etc) and runs a function. Its intended use is to create a validation mechanism, but you can trigger any function, and then just return "true" to enable submit.