COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: radekus on 01 Aug 2011 10:42:34 PM

Title: Month and Year prompt in Cognos
Post by: radekus on 01 Aug 2011 10:42:34 PM
Hi,
I want to make my Date Prompt in my prompt page only show Month and Year (because the date value have to be 25).
I try to custom the Date Prompt, but I can't find any settings to fulfill my requirement.

Any suggestion?
Should I use Value Prompt? But how to implement it?

Thanks for your kindly response.

Regards,

RD
Title: Re: Month and Year prompt in Cognos
Post by: raiff_cog on 02 Aug 2011 04:58:37 AM
Hello Radekus!

Your problem could be solved by using Value Prompt which would get your wanted dates from a query.

For instance, this would be query for Oracle DB which gets dates as you have descibed it, bounded with today's date and 01.01.2008:
SELECT report_date,
       TO_CHAR(report_date, 'yyyy-mon') AS prompt_date
  FROM (SELECT ADD_MONTHS(TRUNC(SYSDATE, 'MONTH'), -TRUNC(MONTHS_BETWEEN(SYSDATE, TO_DATE('2008-01-01', 'yyyy-mm-dd'))))
               - 1
               + ROWNUM AS report_date
          FROM all_objects
         WHERE ROWNUM <= TRUNC(SYSDATE) - TO_DATE('2008-01-01', 'yyyy-mm-dd')) base_data
WHERE report_date <= SYSDATE
   AND EXTRACT(DAY FROM report_date) = 25

When tying value prompt to results of the query, you should choose report_date for Use Value Property, and prompt_date for Display Value Property.

Hope this helps!  :)