COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: sergiord2016 on 02 Nov 2018 04:41:00 AM

Title: set parameter with default value (calendar)
Post by: sergiord2016 on 02 Nov 2018 04:41:00 AM
Hi ,

I have a report that receives the filter date from a calendar that the user can select.

The problem is that i want to send via email that report in a automatic way . I want to set the parameter the actual date , how can i fix the calendar parameter? Do i have to drop the calendar and change the parameters?

The perfect solution would be to make teh calendar take a default value (actual date) if the report executes automatically.

thanks in advance.
Title: Re: set parameter with default value (calendar)
Post by: BigChris on 02 Nov 2018 05:20:50 AM
I use this approach so much that I wrote a blog post about it :)

http://cognostips.weebly.com/blog/date-prompts (http://cognostips.weebly.com/blog/date-prompts)
Title: Re: set parameter with default value (calendar)
Post by: sergiord2016 on 05 Nov 2018 03:00:59 AM
I feel this is different that what i am looking for.

I need to pass the actual date to the Pdate parameter of teh calendar.

Hoy can i assign a getdate() value to the parameter that manages the calendar?

Thanks in advance.
Title: Re: set parameter with default value (calendar)
Post by: CognosPaul on 05 Nov 2018 05:44:15 PM
The easiest way would be to modify the prompts in the queries to use a prompt macro instead of a prompt alias. Then you can do something like:

[Namespace].[Time Dim].[Date] = #prompt('p_Date','date','getDate()')#

if the p_Date parameter is null, it will default to getDate().
Title: Re: set parameter with default value (calendar)
Post by: sergiord2016 on 06 Nov 2018 03:24:38 AM
Thank you very much.

It works!!! Thanks CognosPaul!