Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time Diff Formula within the same Field 1

Status
Not open for further replies.

gusc999

Technical User
Joined
Nov 20, 2007
Messages
42
Location
US
Evening,

I'm currently trying to create a time diff formula that will give me the time diff for RECORDS within the same field. I've had no luck and any help is greatly appreciated

Thanks

Time Diff between:
7:59 & 8:20 = 21min
8:52 & 10:29 = 37min

Example below:
DATE START END TIME
20080915 7:11 pm 7:59:21PM--
20080915 7:38 pm 8:20:56PM-- 21min
20080915 8:29 pm 8:52:59PM--
20080915 9:01 pm 10:29:29PM-- 37min

 
Use datediff and previous functions

@timediff

if not onfirstrecord then
datediff("n", previous({Datetime}), {DateTime})

This will return time diff in minutes.

Ian
 
Is the {DateTime} field the Start field I have as the example?
 
No your end time.

You will also have to come up with a condition that stops the formula evaluating for lines 2& 3, as per your example.

Ian
 
The field names above were just examples, the statment below has the proper field names. I copied the formula you suggested with the proper names but I'm not getting the any result instead I'm getting an error message. Also the condition you are recommending to do I'm afraid I do not know how to to. Can you help me with that?


if not onfirstrecord then
datediff("n", previous({@L-End-X}), {@L-End-X})

Error message:
This field has no previous or next value
 
You have to show the content of your {@L-End-X} formula and of any nested formulas. Sounds like you might have used variables.

-LB
 
Can you give me an example?
 
As LB says just open the formula {@L-End-X} and paste contents here so we can see what is going on.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top