COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Nilam on 06 Mar 2014 03:12:10 AM

Title: year(current_date) ???
Post by: Nilam on 06 Mar 2014 03:12:10 AM
Hi Expert,

Can we use year(current_date) in the default selection of value prompt ??

please help...

Thanks a lot.
Title: Re: year(current_date) ???
Post by: BigChris on 06 Mar 2014 03:41:40 AM
Not out of the box. You'll need to look at either the prompt api, or else javascript.
Title: Re: year(current_date) ???
Post by: Nilam on 06 Mar 2014 03:54:08 AM
How to use prompt api???
can you plz explain it???
Title: Re: year(current_date) ???
Post by: navissar on 06 Mar 2014 04:31:26 AM
Actually, there's an out-of-box way that I try to use whenever possible (Because I try to avoid scripts where a built in functionality exists).
1. Add a static value to your year prompt; use value=1, display value= current year.
2. (Possible, for elegance, not required): filter you year prompt's query to not include the current year ([year]<>extract(year,current_date))
3. Set your main query's filter to something along these lines:
(?prmYear?=1 and [year]=extract(year,current_date) or ([year]=?prmYear?)
4. set the default selection of the prompt to 1.
Title: Re: year(current_date) ???
Post by: Nilam on 06 Mar 2014 05:09:50 AM
Thanks ..
But I have query based value prompt(hierarchy like Year, season, Months, weeks).
Plz help it very urgent...

Thank you.
Title: Re: year(current_date) ???
Post by: MFGF on 06 Mar 2014 07:02:23 AM
Quote from: Nilam on 06 Mar 2014 05:09:50 AM
Plz help it very urgent...

Please don't do this. It is very rude to be pushy like this.

Take a look at Paragraph 2:

http://www.cognoise.com/index.php/topic,24030.0.html

Thanks.

MF.
Title: Re: year(current_date) ???
Post by: Lynn on 06 Mar 2014 07:34:01 AM
This is the same question you already posted here: http://www.cognoise.com/index.php/topic,24099.0.html

Please review Paragraph 4 here: http://www.cognoise.com/index.php/topic,24030.0.html

Have you experimented at all with the techniques that Nimrod provided? Is this a dimensional or relational source? Does the prompt control use static choices? What is the expected behavior for the various choices?

You got a perfect answer from Nimrod for the question you asked and now you reveal there is more but don't fully explain the requirement. It isn't really a good use of anyone's time, including your own, to approach things in this manner.