COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: sriYA on 16 Jun 2020 09:25:59 AM

Title: Work arounds on date prompts
Post by: sriYA on 16 Jun 2020 09:25:59 AM
I need some help with dates

There is a date prompt on a report.
•   When the user enters a custom date the report should display prompt date.
•   When the user leaves the date blank on the prompt page then it should pick up the data item value from the report.

I used Case when ?promptDt? is null then [Invoice_Date] else ?propmtDt? end

My issue is, as soon as I add this code the date on the prompt page turns into mandatory.
The users want this to be blank.

TIA
Title: Re: Work arounds on date prompts
Post by: hespora on 18 Jun 2020 10:31:03 AM
Using the ?name? syntax to reference parameters will indeed make the corresponding prompts mandatory. You need a prompt macro with default value instead.

Change your data item to:

#prompt( 'promptDt', 'token', '[Invoice_Date]' )#
Title: Re: Work arounds on date prompts
Post by: Cape Cod Gunny on 23 Jun 2020 08:37:24 AM
You could create a prompt page with a single Date Prompt. Set Date Prompt Required = False. Filter the report using the Date=?Date Prompt? and make the filter "optional".
Title: Re: Work arounds on date prompts
Post by: hespora on 24 Jun 2020 02:40:32 AM
His/her usage of the parameter was in a data item rather than a filter. There's no making those optional. ;)
Title: Re: Work arounds on date prompts
Post by: aetcognos on 26 Jun 2020 04:56:49 PM
Quote from: hespora on 18 Jun 2020 10:31:03 AM
Using the ?name? syntax to reference parameters will indeed make the corresponding prompts mandatory. You need a prompt macro with default value instead.

Change your data item to:

#prompt( 'promptDt', 'token', '[Invoice_Date]' )#

Yes this should work, although I would change it to date instead of token, and you would get an optional date prompt when viewing tabular data or  running a report.

#prompt( 'promptDt', 'date', '[Invoice_Date]' )#