COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: mederik on 27 Apr 2012 08:26:48 AM

Title: 2 differents default values in a tree prompt : how to make it work in the report
Post by: mederik on 27 Apr 2012 08:26:48 AM
Hi everyone,

I have a big problem to solve and I'll try to explain it simply.
Title: Re: 2 differents default values in a tree prompt : how to make it work in the report
Post by: mederik on 27 Apr 2012 11:23:50 AM
Hi,

After 4 days of headache and folding cognos upside down I finally found a very simple and elegant solution to that problem. It's a tiny javascript that goes all along the tree and select any member on the tree where specified. The only drawback is that it can only select level 1 members. Hopefully in my cas, my two default members to be choosen are level 1.

So for those who that may find it interesting here is how :


<div id='my_tree'>


</div>
<script>
var node = window.treeTime.getRootNode().getChildren()[window.treeTime.getRootNode().getChildren().length-2];
node.setSelected(true);
node.updateNodeSelection();
node.updateParent();
window.treeTime.setLastSelectedNode(node);
</script>


And that's it :D

So thanks a lot to Paul's Blog http://cognospaul.wordpress.com/ (http://cognospaul.wordpress.com/) because it's there I found that great little script that saved my ass  8)