COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: dust0000 on 03 Nov 2016 07:44:57 AM

Title: CAST function not working in Congos 10
Post by: dust0000 on 03 Nov 2016 07:44:57 AM
Hello Everybody,

I have a date code works well in Cognos 8.4 but cannot work on Cognos 10.

_add_months((Cast((extract(YEAR,{sysdate})||'-'||extract(Month,{sysdate})||'-16'),DATE)),-1)

Normally, I need find 16th for each month by current date. I cannot use current_date as well.

Do you have any suggestion?

Thank you very much!

Title: Re: CAST function not working in Congos 10
Post by: MFGF on 03 Nov 2016 08:02:07 AM
Quote from: dust0000 on 03 Nov 2016 07:44:57 AM
Hello Everybody,

I have a date code works well in Cognos 8.4 but cannot work on Cognos 10.

_add_months((Cast((extract(YEAR,{sysdate})||'-'||extract(Month,{sysdate})||'-16'),DATE)),-1)

Normally, I need find 16th for each month by current date. I cannot use current_date as well.

Do you have any suggestion?

Thank you very much!

Yes

Replace the whole expression with

_add_days (_first_of_month (current_date), 15)

MF.