COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => Topic started by: pw on 12 Sep 2005 03:03:59 AM

Title: currentmonth?
Post by: pw on 12 Sep 2005 03:03:59 AM
Hi Folks,

i am just trying to get the current month in a query filter.
what i did was:

<dataelement> = TO_CHAR(current_date; 'YYYY') AND
<dataelement2> = TO_CHAR(current_date; 'MM')

But i get errors. can anybody help?

Thanks in advance,
regards
Philipp
Title: Re: currentmonth?
Post by: Draoued on 12 Sep 2005 05:11:21 AM
what does your dataelement contain ??

Is it a string or a number ??

have you tried the following
<dataelement> = to_number(TO_CHAR(current_date; 'YYYY'))
Title: Re: currentmonth?
Post by: pw on 12 Sep 2005 05:31:20 AM
The data element contains the year as string.

i don't know whether current_date is the right value for this filter action... but i could'nt find any other suitable value.
Title: Re: currentmonth?
Post by: Draoued on 12 Sep 2005 05:38:02 AM
What is your database ??

IF it s oracle , you can use the sysdate.
Title: Re: currentmonth?
Post by: pw on 12 Sep 2005 05:39:53 AM
yes it is an oracle 9.i something ;)

is it then:
[YEAR] = TO_CHAR(sysdate;'YYYY')

?
Title: Re: currentmonth?
Post by: Draoued on 12 Sep 2005 06:46:32 AM
[YEAR] =  to_char({sysdate},'YYYY')


hopefully you have enabled the Oracle function in your package.
Title: Re: currentmonth?
Post by: Draoued on 13 Sep 2005 04:31:09 AM
Is it functionning now ??