Tuesday, June 15, 2010

Tree Prompt Dynamic Default Selection

I have a requirement to default my tree prompt to a dynamic value say current year. This is not achievable directly so I tried looking up any existing JavaScript codes but with no luck.

Hence I was forced to dig through the Cognos Source Code to see if any of the internal functions could be used and I did come across a function that could be used to set the default values. There are still some issues with this code for example deselecting a child node doesn't deselect the parent node if no other child nodes are selected.

But the users are willing to live with this. I am not going to post this code unless someone desperately requires the same as I would not like anyone to face issues either upgrading the reports or have this code interfere with any other code in the report. This is not a tried and tested method as well. In case I don't run into any issues with this code and if I am able to iron out the other minor issues I will post the same.
 

12 comments:

test said...

Hi,

Can you make the prompt keep collapsing to the lowest level?

Thank you,
Christian

Zephyr said...

Hi Christian,

Unless its a property that can be set from Report Studio I don't think we can manipulate it. Also, its risky playing with the underlying code.

Anonymous said...

Hi!
Do you know if I can do a Tree prompt for a relational report??
But the DMR didn't work because of the big mass of Data. It's the Cost Center Structure of a bank.
Thankss!!

Rodrigo

Zephyr said...

Hi Rodrigo, You can create a Tree Prompt on a Relational Model. I was supposed to write on that but never got to it ;-). There is an article in Cognos Support on that.

Let me know if you need to me dig that up for you....

Anonymous said...

Hi Zephyr!
I tried to find this article on IBM website but.. no success!
Could you help me with that? Or give me a clue? =)

Thanks for your support!

Rodrigo

Zephyr said...

Here's the link:

http://www.ibm.com/developerworks/data/library/cognos/page310.html

I will soon post on this :-)

Anonymous said...

Thanks a lot Zephyr!!
I get how to do and everything..very interesting!
The problem is the prompt..because I have a SQL Query directly on the report, and I need these prompt there..so i can't do like on this manual..
But thanks for your help and support!

Rodrigo

Anonymous said...

Hi Zephyr,

I have a similar requirement from my users, to dynamically set default values based on the person running the report.

Can you share your code, please.

We anyway already have a whole lot of javascript that we doubt we will every migrate successufully to cognos 10

Anonymous said...

I have three crosstabs in my report for which they are filtered based on a tree prompt parameter(Event Date) of tree prompt and I am using OLAP model. Where as I want to default the report for the current period which has the recent cube built hour in that.


When I am trying to introduce the default selection for the tree prompt, its throwing me this error


OP-ERR-0145 Unsupported comparison between objects in different dimensions


Please give me some suggestion on implementing the default selection of the tree prompt


Thanks in advance.

Anonymous said...
This comment has been removed by a blog administrator.
Zephyr said...

Unfortunately there is no way of setting default dynamic values in tree prompt. You cannot set members from other dimensions or hierarchies as default values which is the reason for your error.

I would suggest providing other alternative to users like radio-button options for either running report with default period or choosing values from tree prompts. Or you can put in a message in your prompt page informing users that when no values are selected the report would run for default values.

I know users can be tough to please but tool limitations are limitations...Let me know how it goes for you.

Mahesh said...

I want to remove the '+' sign that appears next to the lowest node when using a DMR hierarchy for creating a Tree Prompt. Is there a way of doing this. It is very confusing to the users. Region Hierarchy has Region->Country->State->City. The Prompt shows a '+' sign next to City and when user clicks on it, gives an error. So want to remove th '+' sign