COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Rafiq_123 on 06 Feb 2018 02:37:03 AM

Title: Dynamic date prompts
Post by: Rafiq_123 on 06 Feb 2018 02:37:03 AM
Hi. I need to create 2 date /time prompts where first prompt defaults to 60 before the current date and the next sticks to current date and time. Pls help.
Title: Re: Dynamic date prompts
Post by: BigChris on 06 Feb 2018 03:23:57 AM
I'm sure you can do something more elegant with Javacript, but I'd solve this with a prompt that gives the users a choice between date prompts and the default 60 day range. In your prompt page, you'd have one prompt called ?pDateOption? that has two static options of 'Date Range - select below' and 'Last 60 Days'. Make it a radio button and make it required. Below that have two standard date prompts, called something like ?pBegin? and ?pEnd?

Then in your filter you would have a statement like
?pDateOption? = 'Last 60 days' and [YourDateField] between _add_days(current_date,-60) and current_date
or ?pDateOption? = Date Range - select below' and [YourDateField] between ?pBegin? and ?pEnd?
Title: Re: Dynamic date prompts
Post by: Rafiq_123 on 06 Feb 2018 03:47:03 AM
BigChris. Thanks for sharing your thoughts, but that wouldn't work for me. I have incorporated this in a few reports, where user where given options to choose between no. Of days and date range. But this new report had no mention of this dual option in the requirements. Looking for a way that the from _date date/time prompt defaults to current_date-60 on prompt page generation