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.1 Prompt API for Tree Prompt

Started by cognos810, 16 Sep 2015 07:03:04 AM

Previous topic - Next topic

cognos810

Hi Guys,
Using the Prompt API in Cognos 10.2.1 and javascript, I need to be able to select the root node of the tree. Looking at the code below, is there anything I am missing?
Everything in the below piece of javascript works fine, except for the commented line. Basically, using a "Clear Prompts" button I have to clear all the prompts, and then set them back to their default values, the root node being the default for the tree prompt.

<script>
function clearAllValues() {
var oCR = cognos.Report.getReport("_THIS_");
var oc = oCR.prompt.getControlByName("Month2");
var promptValues = oc.getValues(true);
oc.setValues([{'use':promptValues[0].use, 'display': promptValues[0].display }]);

var oc1 = oCR.prompt.getControlByName("workforce");
var oc2 = oCR.prompt.getControlByName("ordertype");
var oc3 = oCR.prompt.getControlByName("providergroup");
var oc4 = oCR.prompt.getControlByName("legalentity"); //this is the tree prompt.

oc1.clearValues();
oc2.clearValues()
oc3.clearValues();
oc4.clearValues();//Tree prompt selections get cleared

//Setting the values does not work.
//oc4.setValues([{'use':'[Business].[Region Hierarchy].[Region Hierarchy].[All]->[all]', 'display': 'All'}]);

}
</script>

Please suggest.

Regards,
Cognos810