COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Sheldon on 26 Feb 2010 12:16:10 PM

Title: Date Comparison In ReportNet
Post by: Sheldon on 26 Feb 2010 12:16:10 PM
I'm a newbie to Cognos 8.4/ReportNet and am writing my first Cognos report using Report Studio in an educational environment. In the following scenarion, I would like to only show records where [School year], a Date/Time field, is equal to the following:
[Program Participation].[Program Codes].[School Year]='Jun 30, 2006 12:00:00 AM'
I get an SQL error but I'm not sure how to make the comparison and only show records with the above date. Thanks for any help/suggestions.

Sheldon Potolsky
Title: Re: Date Comparison In ReportNet
Post by: Nuffsaid on 26 Feb 2010 03:06:48 PM
Hi,

You're trying to compare a date/time field to a string. You can't use single quotes around dates.

If you're not interested in the time portion try something like the following;

trunc([Program Participation].[Program Codes].[School Year]) = 2006-06-30



Nuffsaid.
Title: Re: Date Comparison In ReportNet
Post by: Sheldon on 02 Mar 2010 10:43:59 AM
Thanks.  Since I was mainly interested in the year, the following seemed to work:
to_char([Program Participation].[Program Participation].[School Year],'yyyy') = '2010'

Sheldon