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

Using javascript to select value in Tree

Started by Adelyra, 21 Sep 2010 07:49:21 AM

Previous topic - Next topic

Adelyra

Good morning!

I'm working on a page where a report that is responsible for the main content displays default information based on the users id information. The user is able to click a button and change the parameters via a Tree prompt.

What I'd like to do is add a text field to the prompt page and, when a value is entered, have javascript search through the tree prompt and highlight the value they've entered (so they don't have to spend hours searching through thousands of records).

Here's the code I have so far:

<script type="text/javascript">

function findTreeNode(){

var fcInput = document.getElementById('fcInput').value;

if(window.treeMyTreePrompt){

var tree = window.treeMyTreePrompt.getLastSelectedNode();
var treeVal = tree.getValue();

alert(treeVal);

if(treeVal == '[Dashboard Cube EN].[Organization].[Fund Centre Hierarchy].[Level 2]->:[PC].[@MEMBER].[FC_LVL2_' + fcInput + ']' ){
alert("Level 2");
}
if(treeVal == '[Dashboard Cube EN].[Organization].[Fund Centre Hierarchy].[Level 3]->:[PC].[@MEMBER].[FC_LVL3_' + fcInput + ']'){
alert("Level 3");
}
if(treeVal == '[Dashboard Cube EN].[Organization].[Fund Centre Hierarchy].[Level 4]->:[PC].[@MEMBER].[FC_LVL4_' + fcInput + ']'){
alert("Level 4");
}
if(treeVal == '[Dashboard Cube EN].[Organization].[Fund Centre Hierarchy].[Level 5]->:[PC].[@MEMBER].[FC_LVL5_' + fcInput + ']'){
alert("Level 5");
}

}else{
alert("NO");
}

}

</script>

<input type='text' id='fcInput' value=''/>
<input type='submit' value='Find Fund Centre' onclick='findTreeNode()' />


To explain a little further, the reason I can't just put the value from the input text field into the querystring is because I need to know the level attached to the value (each time you expand a node it counts as a level -- there are 5 in total). Also, there are several instances where the value is identical but the level is different (ex: value 14400, level 2 AND value 14400 level 4)

I hope this makes sense. I'm not terribly familiar with programming in Cognos products but I have a background in web development.