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

[OLAP report] Default value for report-level prompt

Started by cogswell, 07 Nov 2011 09:13:27 AM

Previous topic - Next topic

cogswell

I have a powercube report with no prompt page and a value prompt on the report page for selecting a month-year from the time dimension.

For that prompt, I need to set the default value to the current (latest) month. I tried the following for the value prompt's 'Default Selections':
roleValue('_memberUniqueName', item(tail(members([Cube].[Time].[Time].[Month])), 0))
and
item(tail(members([Cube].[Time].[Time].[Month])), 0)

but I get the error
QuoteOP-ERR-0217 An unexpected type of parameter value was encountered. The specified parameter type is 'unknown', but the expected type is 'memberUniqueName'.

How do I go about setting this?

EDIT: I guess I'm asking the age-old 'how to set a dynamic default selection for a value prompt', but with a slight twist.

CognosPaul

The default value in a value prompt has two primary functions. The first is that it attempts to highlight all of the referenced default values in the prompt list. So if your prompt shows 1, 2, 3 and your default values are 3, 4, 5 only 3 would be highlighted. The second function is that it sends whatever is contained in the default value directly to the query. Since the prompt is expecting a MUN, and receiving a member expression, it's throwing an error. You would get the same error if you tried to send a string to a numeric prompt or a number to a date prompt.

So understanding those two concepts, there are two basic ways of achieving your goal. JavaScript can be used to automatically highlight the correct month, but the JavaScript itself is only triggered after the page is loaded. Also, the use of JavaScript tends to be frowned upon, so in this case I'll detail a method without.

To begin, add a static item display: Current Month and use:  item(tail(members([Cube].[Time].[Time].[Month])), 0)

Since the default value now matches one of the items in the prompt list, the Current Month will automatically be highlighted.

The next step is to change the prompt in the query. Since you're passing an expression the parameter type has to be a token. The prompt itself should look like: #prompt('Current Month','token')#

pram.b

Hi Paul

I am looking for something similar:
1. to display Current Month as default value
2. and in prompt display like Cognos 7 Upfront all other relative time categories like WTD, MTD, YTD, PYTD etc. in same prompt
3. with option of selecting 'All' also.

Is this possible via Cognos 10.2.1 functionality or JavaScript needs to be applied for dimensional cube based report?