COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: LDJB81 on 16 Jan 2014 07:35:28 AM

Title: Populate prompt default selection from parameter map
Post by: LDJB81 on 16 Jan 2014 07:35:28 AM
Hi all,

Is it possible to assign a default selection to value and tree prompts from a parmeter map? I want to assign different default selections based on whoever logs in to the report. I can imagine this might be tricky for the tree prompt!

Thanks
Lloyd
Title: Re: Populate prompt default selection from parameter map
Post by: CognosPaul on 16 Jan 2014 09:21:39 AM
There are a few ways. Which version are you using?

The easiest way would be to create a hidden prompt page. Stick all of your prompts in there, wrapped in HTML items that hide them with <div style="display:none"></div>. You would get the prompt values with a singleton, and select the option from there. Once the values have been selected, have the JS automatically send a "finish" or "next" action.
Title: Re: Populate prompt default selection from parameter map
Post by: LDJB81 on 16 Jan 2014 10:03:46 AM
I'm using 10.1.1

Not sure I understand what you mean. I will explain what I have in more detail.

Prompt Page 1 has 2 prompts with have static choices. These results of these 2 static choices are then concatentated in token prompt (dynamic query subject selection) to filter the members displayed in a tree prompt on Prompt Page 2. The users want to go straight in to prompt page 2 without selecting anything on prompt page 1. Now my thinking was I could have a table with the user ID and 2 other fields which hold the default selections for each user and then have 2 parameter maps. Could I put the parameter map expression with $$ straight in to the default selection property? or maybe create a calculation in FM and reference that?
Title: Re: Populate prompt default selection from parameter map
Post by: CognosPaul on 20 Jan 2014 04:47:24 AM
If you have the values in a parameter map, then use those instead of the prompt. Can you share how you're filtering the tree prompt query now? It may be as simple as swapping out the prompts for the param maps.

Are you using the prompts anywhere else? Do the controls themselves need to have the values, or are they only used for filtering the tree?
Title: Re: Populate prompt default selection from parameter map
Post by: LDJB81 on 20 Jan 2014 03:00:08 PM
Yes this is what I ended up doing, I merged the 2 parameter maps instead of using prompts. For the tree prompts, I made them optional, added the user specfic MUNS to the table and created 2 new parameter maps. I used these in the default selection part of a prompt macro and done away with the prompt pages. This works well, I have a dynamic default selection for each user but the problem is going to be maintaining the table going forward. I dont think the client will go for it but it was a useful excercise.

Prompt('pPrompt','MUN',$(PM{account.defaultname})