COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: raj_aries81 on 12 Jun 2014 02:40:39 PM

Title: How to Pass a Blank default Value in Prompt Macro for OLAP Report
Post by: raj_aries81 on 12 Jun 2014 02:40:39 PM
Hi All

In an OLAP report, I would like to pass a blank default value for a column something like #prompt('Param_Col','token','')#
instead of #prompt('Param_Col','token','[Hub Cube].[Listing (All)].[Listing (All)].[Product]')#.However, the report fails with parsing error.

How do I pass a default value

Regards
Raj
Title: Re: How to Pass a Blank default Value in Prompt Macro for OLAP Report
Post by: raj_aries81 on 12 Jun 2014 04:06:40 PM
Do I need to use emptySet function..Please help !!
Title: Re: How to Pass a Blank default Value in Prompt Macro for OLAP Report
Post by: Francis aka khayman on 13 Jun 2014 01:30:43 AM
this worked for me:

#prompt('test','token','[My Package].[Time].[Time].[Month]')#
Title: Re: How to Pass a Blank default Value in Prompt Macro for OLAP Report
Post by: MFGF on 13 Jun 2014 08:54:22 AM
Quote from: raj_aries81 on 12 Jun 2014 02:40:39 PM
Hi All

In an OLAP report, I would like to pass a blank default value for a column something like #prompt('Param_Col','token','')#
instead of #prompt('Param_Col','token','[Hub Cube].[Listing (All)].[Listing (All)].[Product]')#.However, the report fails with parsing error.

How do I pass a default value

Regards
Raj

Hi,

There is no concept of a member being blank in an OLAP cube. What exactly are the requirements for putting blank in as a default value? Would it make sense to use the root member of the dimension as the default?

Cheers!

MF.
Title: Re: How to Pass a Blank default Value in Prompt Macro for OLAP Report
Post by: MDXpressor on 16 Jun 2014 11:40:48 AM
I'm no macro expert, but if you just want a null:

if (  #sq(prompt('your prompt', 'token', 'default text'))# = 'default text') then (null) else ([something else])

I make no claims as to how the OLAP query engine would handle the null member.  It would probably drop it from your crosstab container. 

Anyhow, you MUST include the 3rd parameter (default text) if you don't want a prompt page to show up.  But as I did, just put it in an if then else, and set it's result to null if the default text is submitted as the response for your prompt.
Title: Re: How to Pass a Blank default Value in Prompt Macro for OLAP Report
Post by: bdbits on 16 Jun 2014 01:35:44 PM
This is for a drill-through? If so, I have found the easiest thing for a default value is to allow the parameter to be missing (null) in the target. Then, in the target report, check the parameter with filter() or a prompt macro to set the default value if the parameter is null. I have mostly used this technique with date parameters, but other data types should also work.