Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: time field problem Post Reply Post New Topic
Author Message
lupao
Newbie
Newbie
Avatar

Joined: 16 Feb 2010
Online Status: Offline
Posts: 6
Quote lupao Replybullet Topic: time field problem
     Posted: 16 Feb 2010 at 11:50am
hi everyone.......

I'm new, so please help me..I'm having a problem in my report..I can't compute the fields for time..I'm making a report for attendance and the computation of the time field..my report looks like

TimeInAM     |     TimeOutPM     |    TimeInPM    |    TimeOutPM   |   Total

hh:mm:sss          hh:mm:sss         hh:mm:sss        hh:mm:sss       ????
hh:mm:sss          hh:mm:sss         hh:mm:sss        hh:mm:sss       ????


                                                                            
                                                                                 Total time:      ????
lup
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2010 at 1:28pm
are all 4 fields always filled in?
if so just use a datediff formula to get the values:
datediff('n',timeinAM,TimeOutPM) +
datediff('n',timeinPM,TimeOutPM)
IP IP Logged
lupao
Newbie
Newbie
Avatar

Joined: 16 Feb 2010
Online Status: Offline
Posts: 6
Quote lupao Replybullet Posted: 16 Feb 2010 at 9:02pm
hello..

not all the fields are always filled..because its attendance computation..
will this formula work??
lup
IP IP Logged
lupao
Newbie
Newbie
Avatar

Joined: 16 Feb 2010
Online Status: Offline
Posts: 6
Quote lupao Replybullet Posted: 16 Feb 2010 at 9:11pm
hi..
it ddn't work..theres an error: A Date is required here..
lup
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Feb 2010 at 7:20am

1. Since not all fields are always filled in how do you handle this? Does that mean that at least field 1 and 2 are filled or 3 and 4 are filled?

2. Since you are getting that error what is the field type for these 4 'time' fields?

IP IP Logged
lupao
Newbie
Newbie
Avatar

Joined: 16 Feb 2010
Online Status: Offline
Posts: 6
Quote lupao Replybullet Posted: 17 Feb 2010 at 11:47am
hi..

1. Yes, because the employee my be absent for am and present on pm..
2. What to you mean by field type?in my DB the data type of the fields is time.
lup
IP IP Logged
lupao
Newbie
Newbie
Avatar

Joined: 16 Feb 2010
Online Status: Offline
Posts: 6
Quote lupao Replybullet Posted: 17 Feb 2010 at 11:49am
hi..

1. Yes, because the employee my be absent for am and present on pm..
2. What to you mean by field type?in my DB the data type of the fields is Time.

please help me..


lup
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Feb 2010 at 1:19pm
Maybe this?
(If isnull(timeinAM) or isnull(timeOutPM) then 0 else
datediff('n',cdatetime("1/1/1900" +totext({InTImeAM})),cdatetime("1/1/1900" +totext({TimeOutPM})))
+
(If isnull(timeinPM) or isnull(timeOutPM) then 0 else
datediff('n',cdatetime("1/1/1900" +totext({InTImePM})),cdatetime("1/1/1900" +totext({TimeOutPM})))
IP IP Logged
lupao
Newbie
Newbie
Avatar

Joined: 16 Feb 2010
Online Status: Offline
Posts: 6
Quote lupao Replybullet Posted: 17 Feb 2010 at 11:56pm
Hello DBlank..can you please provide me the complete code?
lup
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum