COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: andy_mason_84 on 29 Oct 2012 06:41:02 AM

Title: Making a Prompt optional from within a Data Item.
Post by: andy_mason_84 on 29 Oct 2012 06:41:02 AM
Hi All,

OK - in my report I have a data item, which is running two prompts from Company Description.

for example:
MAXIMUM( IF ([Company Description]=?Nominated?) THEN (1) ELSE (0)  for [Product Code])

MAXIMUM( IF ([Company Description]=?Selected?) THEN (1) ELSE (0)  for [Product Code])

This is so we only bring in products which certain company has ordered, but we can still bring in the data from other companies who have ordered the same product for comparisons.

When i run the report this parameter is 'Required', any idea how to make it optional when it is not in the Detailed Filters section so it is not as easy as clicking on it and making it Optional.

Any ideas?

Cheers,

AM
Title: Re: Making a Prompt optional from within a Data Item.
Post by: pricter on 29 Oct 2012 06:54:17 AM
I can think two possible ways

The first is to add to your prompt a static choice and make it the default selection.

The second to use the macro "prompt" and set a dummy default selection in the macro.
Title: Re: Making a Prompt optional from within a Data Item.
Post by: Bark on 13 Nov 2012 09:09:53 AM
Quote from: andy_mason_84 on 29 Oct 2012 06:41:02 AM
Hi All,

OK - in my report I have a data item, which is running two prompts from Company Description.

for example:
MAXIMUM( IF ([Company Description]=?Nominated?) THEN (1) ELSE (0)  for [Product Code])

MAXIMUM( IF ([Company Description]=?Selected?) THEN (1) ELSE (0)  for [Product Code])

This is so we only bring in products which certain company has ordered, but we can still bring in the data from other companies who have ordered the same product for comparisons.

When i run the report this parameter is 'Required', any idea how to make it optional when it is not in the Detailed Filters section so it is not as easy as clicking on it and making it Optional.

Any ideas?

Cheers,

AM


MAXIMUM( IF ([Company Description]=#prompt('Nominated','datatype','defaultValue')#) THEN (1) ELSE (0)  for [Product Code])

Where datatype can be integer, string, memberuniquename (if a cube), etc... and defaultValue will be the value to apply if the prompt is not selected.

Regards,

Bark
Title: Re: Making a Prompt optional from within a Data Item.
Post by: maxchuie on 10 Feb 2014 12:18:01 PM
I have a data item with a prompt that I need to make not required is there a way?

Case ?pRankGroup?
When 'Top 5' then '5'
When 'Top 10' then '10'
When 'Top 15' then '15'
When 'Top 20' then '20'
When 'Top 25' then '25'
Else 'All'
end
Title: Re: Making a Prompt optional from within a Data Item.
Post by: Lynn on 17 Feb 2014 08:25:32 AM
Why not try a prompt macro with a default option as suggested in the earlier posts?
Title: Re: Making a Prompt optional from within a Data Item.
Post by: maxchuie on 17 Feb 2014 09:39:45 AM
Never done a prompt macro will give it a try thx
Title: Re: Making a Prompt optional from within a Data Item.
Post by: Lynn on 17 Feb 2014 09:56:49 AM
I think the FM user guide has decent documentation on the prompt macro. Works the same way in Report Studio.

I think you could just replace ?pRankGroup? in your expression with the macro below. That syntax would reference your parameter name, specify string as the datatype, and All as the default value.

#prompt('pRankGroup','string','All')