Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Hours worked Post Reply Post New Topic
Author Message
mkhenneman
Newbie
Newbie


Joined: 23 Jan 2012
Location: United States
Online Status: Offline
Posts: 7
Quote mkhenneman Replybullet Topic: Hours worked
    Posted: 23 Jan 2012 at 5:37am
Hi evetyone
 
I have a report that looks like this:
 
GROUP1: USERNAME

GROUP2: DATE: xx/xx/xxxx
detail:

log in      8:00
log out 12:00
log in     1:00
log out  5:00
 
trying to calculate total hours worked for the day...
 
any thoughts
 
thanks Mike


 
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 23 Jan 2012 at 6:00am
Two formula fields;
 
Login:
if {table.descfield} = "log in" then datediff("n",{table.timefield},#00:00:00#) else 0
 
Logout:
if {table.descfield} = "log out" then datediff("n",{table.timefield},#00:00:00#) else 0
 
An additional formula field (put in group 2 header or footer);
[code] dateadd("n",sum({@logoutformula})-sum({@loginformula}),#00:00:00#)[/code]
 
I'm just finishing work so haven't got time to check it - if you need further assistance let me know and I'll see what I can do tomorrow.
 
Regards,
Ryan.
IP IP Logged
mkhenneman
Newbie
Newbie


Joined: 23 Jan 2012
Location: United States
Online Status: Offline
Posts: 7
Quote mkhenneman Replybullet Posted: 23 Jan 2012 at 10:11am
Hi Ryan
 
thanks for replying. I tried using the formulas with no success. I'm sure Im not doing something right. I would appreciate some more help when you do have time.
 
let me know when you have some free time
 
Mike
 
 
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 23 Jan 2012 at 10:20am
you could also try something like
Login (formul)
if table.field = "log in" then hour(table.date)
logout(formul)
if table.field = "log out" then hour(table.date)

total hours(formul)
(maximum(logout, date(group))- maximum(logit, date(group))) +
(minimun(logout, date(group)) - minimum(login, date(group)))
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 23 Jan 2012 at 10:38pm
Hi mkhenneman,
 
What seems to be the problem? Looking at kostya's suggestion I would slightly amend my formula's to the following;
 
Login:
if {table.descfield} = "log in" then hour({table.timefield}) else 0
 
Logout:
if {table.descfield} = "log out" then hour({table.timefield}) else 0
 
Summary:
[/code]
 
Regards,
Ryan.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.