Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula urgent help Post Reply Post New Topic
Author Message
wafaa
Newbie
Newbie


Joined: 21 Sep 2008
Location: Kuwait
Online Status: Offline
Posts: 18
Quote wafaa Replybullet Topic: Formula urgent help
     Posted: 21 Sep 2008 at 2:17am
Hi all,
 
Can I put a fixed time such as 08:00:00am instead of the field name in the formula? DateDiff ('N', {#MinEntry}, {#MAXEXIT}) / 60
I want to calculate the lateness in attendence for the staff, the shift starts at 8 am, if the employee came at 08:30:00am should give me like below:
 
Shift Starts       Entry       Mins Late       Shift Ends       Exit       Mins Early     
 
08:00am         08:30am      00:30           03:00:00     02:50         00:10
 
 
Please I need help urgently
IP IP Logged
DaveOnline
Newbie
Newbie
Avatar

Joined: 22 Sep 2008
Location: United States
Online Status: Offline
Posts: 5
Quote DaveOnline Replybullet Posted: 23 Sep 2008 at 5:15am

Give this a shot

DateDiff ("N",Currentdatetime , Cdatetime(currentdate,Ctime("08:00:00am")))
Dave
IP IP Logged
wafaa
Newbie
Newbie


Joined: 21 Sep 2008
Location: Kuwait
Online Status: Offline
Posts: 18
Quote wafaa Replybullet Posted: 23 Sep 2008 at 11:15pm
thank you for your reply.
But should I define Currentdatetime , Cdatetime,currentdate and Ctime before, I'm new in using crystal reports and I need a detailed explanation
IP IP Logged
DaveOnline
Newbie
Newbie
Avatar

Joined: 22 Sep 2008
Location: United States
Online Status: Offline
Posts: 5
Quote DaveOnline Replybullet Posted: 24 Sep 2008 at 2:45am
They are all internal date/time functions in Crystal.  You can look it up in the Crystal help for more info on them.
Currentdatetime gets the current date time from your system.
Ctime just converts the Text time "08:00:00" to actual time.
Cdatetime is used to piece together the date (currentdatetime) and the time you gave it (08:00:00am).
 
You can just copy and paste the function into your report and it should give you the time difference you are looking for.  No need to do anything else unless you want to change the hardcoded time.
 
Hope this helps.
 
P.S.  Currentdatetime and currentdatetime are the same function I just forgot to uppercase the first letter.
Dave
IP IP Logged
DaveOnline
Newbie
Newbie
Avatar

Joined: 22 Sep 2008
Location: United States
Online Status: Offline
Posts: 5
Quote DaveOnline Replybullet Posted: 24 Sep 2008 at 3:14am
OPPS.... Did not read your reply carefully enough, instead of using currentdatetime function in the first part of the function you would replace it with the entry datetime field that you are using.
 
DateDiff ("N",Currentdatetime , Cdatetime(currentdate,Ctime("08:00:00am")))
Dave
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