COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: actcognosuser on 05 Apr 2010 10:27:44 AM

Title: Help needed with time range
Post by: actcognosuser on 05 Apr 2010 10:27:44 AM
All,
          I have a date/time field .I need to filter on a specific time interval.
I extrcated only time fro mthe filed using time(date/time).

Now i need to display time between 9.00 am to 3.00 pm.
I used Time between '09:00:00 AM' and '03:00:00 PM' in the filter
But it did not work.

Also can i specify a time range based on some condition.(i.e based on data item).
for example if dataitem is working day then display tim erange between 9:00 and 3:pm.

Please advise.
Title: Re: Help needed with time range
Post by: the_xxx on 05 Apr 2010 12:15:38 PM
cast the data item to the required format.
Title: Re: Help needed with time range
Post by: actcognosuser on 05 Apr 2010 12:19:44 PM
Should it be a string?I need a time interval.between 9:00 to 3:00?

Thanks in advance!
Title: Re: Help needed with time range
Post by: the_xxx on 05 Apr 2010 12:49:20 PM
Some thing like this,

cast([ACTIVITY_TIME] as time) between cast(?StarTime? as time) and cast(?EndTime? as time)

or try converting to CHAR.
Title: Re: Help needed with time range
Post by: actcognosuser on 05 Apr 2010 12:58:03 PM
Thank you.

I am still not able to get the desired results because i am hard coding the time as '8:00:00 am'
Title: Re: Help needed with time range
Post by: actcognosuser on 08 Apr 2010 07:58:41 AM
All,
       Can we compare a date time value with a string?example
if ([Dataitem1] = 'Business')
then( [time(Date/Time field] between '9:00:00' and 3:00:00)
else
if ([Dataitem1] = 'Office')
then( [time(Date/Time field] between '9:00:00' and 5:30:00)
else()

To achieve this should I cast it to char?What is the best way to achieve this result
Thanks in advance!

Title: Re: Help needed with time interval
Post by: actcognosuser on 09 Apr 2010 12:14:12 PM
Can a string be compared with a date/time value with cast function?