Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...If I'd only had resource like eng-tips when I was just getting started! I might have dazzled them with my brilliance instead of my BS..."

Geography

Where in the world do Tek-Tips members come from?
tkschief (MIS)
22 May 12 9:15
I am using Crystal Reports 11 and have a report that is grouped by case number. In each group, there are 4 events. I'm not sure how to calculate the time difference in minutes between the Locate Date and each of the 3 deadline events. I attempted a formula but the time difference is always 0 so obviously I am doing something wrong.

CASE NUMBER DATETIME EVENT TIME DIFF
Case Number 05/18/12 12:19PM Locate Date
Case Number 05/18/12 12:42PM Deadline Service w/in 90 Days 23 min
Case Number 05/18/12 12:44PM Deadline Order w/in 6 Months 25 min
Case Number 05/18/12 12:47PM Deadline Order w/in 12 Months 28 min

05/18/12 12:47PM is a datetime field
Goal: 1st deadline datetime minus locate datetime = time difference in minutes
2nd deadline datetime minus locate datetime = time difference in minutes
3rd deadline datetime minus locate datetime = time difference in minutes

I thought I would need to create a variable for the Locate Date in order to calculate the time difference between the Locate Date and each of the Deadline dates.

Attempted Formula:
DateDiff('m',{Command.Create Date},{@LocateDateVar})

Attempted Variable:
If {Command.EVENT_TYPE_ID}=1000223 then {Command.Create Date}

Any help would be appreciated. Thanks!


pmsawyer (Programmer)
22 May 12 10:08
In your DATEDIFF funtion you are using the wrong interval. 'm' is for month which will give a 0 for the sample you provided. The correct interval is 'n' for minute. I would use a global variable for the locate date then reference it from the other three records resetting for each group.
lbass (TechnicalUser)
26 May 12 12:21
You could use this:

datediff("n", maximum({@LocateDateVar},{table.casenumber}),{Command.Create Date})

-LB

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close