COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: esanray on 06 Apr 2011 11:16:51 PM

Title: if then else
Post by: esanray on 06 Apr 2011 11:16:51 PM
Database contain  the following data

Schedule time       Actual time.

01:10         04:00
02:00         05:00
04:00         08:00
05: 00         09:00

I need the report         

Hour wise      No of Train

Delay 2+hours         1
Delay 3+hours         1
Delay 4+hours         1

Can you please tell me the steps.
Title: Re: if then else
Post by: blom0344 on 08 Apr 2011 04:59:48 AM
Are Scheduled time and actual time real timestamps?
Title: Re: if then else
Post by: esanray on 11 Apr 2011 07:39:01 PM
yes
Title: Re: if then else
Post by: blom0344 on 12 Apr 2011 01:50:36 AM
something like:


'Delay '||
cast(_round(((extract(hours,[Actual_time])*60+extract(minutes,[Actual_time]))
-
(extract(hours,[Schedule_time])*60+extract(minutes,[Schedule_time])))/60,0),varchar(4))
||'+ hours'


for the hourwise definition


Title: Re: if then else
Post by: PRIT AMRIT on 12 Apr 2011 03:20:31 AM
Nice one though, it will give you parsing error. The code should be
'Delay '||
cast(_round(((extract(hour,[Actual_time])*60+extract(minute,[Actual_time]))
-
(extract(hour,[Schedule_time])*60+extract(minute,[Schedule_time])))/60,0),varchar(4))
||'+ hours'


Should be Hour not Hours, Minute not Minutes..

Thanks
Title: Re: if then else
Post by: blom0344 on 12 Apr 2011 02:56:10 PM
PRIT, thanks for your correction..
Title: Re: if then else
Post by: esanray on 13 Apr 2011 10:58:27 PM
syntax display parsing error
Title: Re: if then else
Post by: PRIT AMRIT on 13 Apr 2011 11:43:19 PM
 ::).... What kind of error you are getting?

I had tested and worked fine for me. You must be missing something?