Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Selecting earliest and latest time Post Reply Post New Topic
Author Message
chadbrewyet
Newbie
Newbie


Joined: 26 Oct 2010
Online Status: Offline
Posts: 22
Quote chadbrewyet Replybullet Topic: Selecting earliest and latest time
     Posted: 22 Jan 2013 at 5:32am
I'm looking to create a report to replace the timesheets that our employees are now creating manually with a report. I would like their time to be displayed based on the time log entries that they enter throughout the day. So, for each day I would want it to show on 1/22/13 this person worked from 8:00am to 4:30 pm for a total of 8.5 hours. In each time log is a "start date/time" and an "end date/time" and I would like to pull just the time value from each field and then select or display only the earliest start time and latest end time for each day. If I try to do a minimum and maximum of each field, it is forcing me to use the date part and not the time. Is there a way to select the min and max based just on the time?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 22 Jan 2013 at 6:38am
as an alternative.
why not group by the employee, make a group for the Date (ignore the time).suppress the details, and display the header and footer record, which would be the earliest and latest for a date respectively.
 
if this doesn't quite fit the bill, you could set a shared variable in the group header (start time), then in the footer you could compute the time using DATEDIFF between the start time from the header and the end time from the footer...you would probably want to suppress the group header (start time) as well.
 
HTH
 
IP IP Logged
chadbrewyet
Newbie
Newbie


Joined: 26 Oct 2010
Online Status: Offline
Posts: 22
Quote chadbrewyet Replybullet Posted: 23 Jan 2013 at 4:55am
Thanks. The first option worked pretty well. There is one thing that I noticed that may present an issue.

There may be times that their time entries may not be entirely sequential. For example, they may have a time entry that runs from 2pm to 5pm, but in that time period they may enter another time entry say from 3pm to 3:30pm. With that 2nd entry and the way the report sorts by start date/time, it will put the 2nd entry last and therefore the end date/time of the last entry will be 3:30pm and not 5pm. Is there a way around that?
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