COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Gnani on 22 May 2015 09:27:14 AM

Title: HOW TO RESTRICT FUTURE DATES IN DATE PROMPT IN COGNOS
Post by: Gnani on 22 May 2015 09:27:14 AM
HOW TO RESTRICT FUTURE DATES IN DATE PROMPT IN COGNOS

I have a requirement which says...
Restrict the user to select Future date in Data prompt.
Eg; if today is 22nd May 2015, then user should not be allowed to select more than today's date. 23rd May or so...

Thanks in Advance
Title: Re: HOW TO RESTRICT FUTURE DATES IN DATE PROMPT IN COGNOS
Post by: Lynn on 22 May 2015 10:08:09 AM
WHAT TYPE OF DATA SOURCE DO YOU HAVE? RELATIONAL OR DIMENSIONAL? WHY ARE WE SHOUTING?

What type of prompt control are you using? If it is a calendar control then you can't really prevent them from picking any date they want. If you are giving a pick list of dates generated by a query then you can limit the contents of the list by including a filter, but the type of data source you have will affect answers on the best way to accomplish this.

You could also consider rendering a page that indicates they've made an invalid selection rather than running the report with the prohibited date selection.
Title: Re: HOW TO RESTRICT FUTURE DATES IN DATE PROMPT IN COGNOS
Post by: MFGF on 22 May 2015 10:53:35 AM
Quote from: Lynn on 22 May 2015 10:08:09 AM
WHAT TYPE OF DATA SOURCE DO YOU HAVE? RELATIONAL OR DIMENSIONAL? WHY ARE WE SHOUTING?

PARDON?
Title: Re: HOW TO RESTRICT FUTURE DATES IN DATE PROMPT IN COGNOS
Post by: bdbits on 22 May 2015 02:36:29 PM
WHAT LYNN SAID. OR IF YOU HAVE SOME JAVASCRIPT SKILLS, YOU CAN ALSO LINK TO CUSTOM VALIDATION ON THE PROMPT PAGE VIA THE PROMPT API. BUT YOU WILL NEED TO HAVE SOME JAVASCRIPT SKILLS.

I THINK GNANI MEANT ALL THE CAPS AS A SORT OF TITLE. I AM USING CAPS FOR MFGF. CAN YOU HEAR ME NOW?  8)
Title: Re: HOW TO RESTRICT FUTURE DATES IN DATE PROMPT IN COGNOS
Post by: Gnani on 22 May 2015 03:00:43 PM
It is relational model and datasource is oracle. You could restrict the future date from calendar prompt only. We have option as last date for Date prompt. That actually works for fixed mentioned date. I want this to be dynamic.


Title: Re: HOW TO RESTRICT FUTURE DATES IN DATE PROMPT IN COGNOS
Post by: CognosAnalytics on 22 May 2015 03:11:08 PM
Hello Gnani,
If thats the case then, your only non-javascript option is to take the user to a page that is rendered conditionally with a message on it, something like "Cannot choose date greater than today", based on the date parameter value selected, and which also has a "Back" button to take the user back to the prompt page to rectify the date value, as Lynn suggests.
Of course, there is the javascript route as per bdbits.

-Cognos810
Title: Re: HOW TO RESTRICT FUTURE DATES IN DATE PROMPT IN COGNOS
Post by: Gnani on 25 May 2015 03:13:51 AM
Thanks Lynn and Cognos810 for your replies..

We don't need to popup something which says.."Can't choose date greater than today".
We can restrict future date for date prompt but it works for only today (hard coded). I want this to be dynamic.

Thanks in advance