# Carrying over a finish time to the next record start time but adding 1 minute

**crtopher**Dec 13, 2010 12:24 AM

### Title

Carrying over a finish time to the next record start time but adding 1 minute

### Post

I have a field StartTime that has an OnObjectEnter script trigger thus:

[IMG]http://i56.tinypic.com/15n6at2.jpg[/IMG]

which takes the previous record's FinishTime and puts it in the StartTime of the next record if it's empty, but enables me to adjust it if needed.

It is also has an AutoEnter calculation that I grabbed from somewhere else here on the forum thus:

Let ( [ nums = Filter ( StartTime ; "0123456789" ) ; chars = Filter (Upper ( StartTime ) ; "AMNP" ) ; lgthN = Length ( nums ) ; lgthC = Length (chars ) ; numTest = Case ( GetAsNumber ( nums ) < 1260 ; 1 ; GetAsNumber (nums ) < 2360 ; 2 ; 0 ) ; charTest = Case ( lgthC > 0 and lgthC < 3 ; 1 ; 0 ) ; mins = Case ( lgthN > 2 ; Right ( nums ; 2 ) ; "00" ) ; hrs = Case ( lgthN > 2 ; Middle ( nums ; 1 ; lgthN - 2 ) ; nums ) ; hrsN = GetAsNumber ( hrs ) ; minsTest = Case ( GetAsNumber ( mins ) > 59 ; 0 ; 1 ) ; hrs12 = Case ( numTest = 2 ; GetAsText ( hrsN - 12 ) ; hrsN = 0 ; "12" ; hrs ) ; suffix = Case ( charTest = 1 and ( PatternCount ( chars ; "A" ) or Exact ( chars ; "M" ) ) ; " AM" ; charTest = 1 and ( PatternCount ( chars ; "P" ) or Exact ( chars ; "N" ) ) ; " PM" ; charTest = 0 and Exact ( Left ( nums ; 1 ) ; "0" ) ; " AM" ; numTest = 2 and hrsN > 12 ; " PM" ; "" ) ; hrsTest = Case ( GetAsNumber ( hrs12 ) > 12 ; 0 ; 1 ) ; suffixTest = Case ( hrsN > 12 and Exact ( suffix ; " AM" ) ; 0 ; 1 ) ; inter = GetAsNumber ( hrs12 & mins )] ;

Case ( numTest = 0 ; "INVALID TIME" ; minsTest = 0 ; "INVALID TIME" ; hrsTest = 0 ; "INVALID TIME" ; suffixTest = 0 ; "INVALID TIME" ; inter > 0 and inter < 700 ; Left ( inter ; 1 ) & ":" & Right ( inter ; 2 ) & If ( not IsEmpty ( suffix ) ; suffix ; " PM" ) ; inter >= 700 and inter < 1000 ; Left ( inter ; 1 ) & ":" & Right ( inter ; 2 ) & If ( not IsEmpty ( suffix ) ; suffix ; " AM" ) ; inter >= 1000 and inter < 1200 ; Left ( inter ; 2 ) & ":" & Right ( inter ; 2 ) & If ( not IsEmpty ( suffix ) ; suffix ; " AM" ) ; inter >= 1200 and inter < 1260 ; Left ( inter ; 2 ) & ":" & Right ( inter ; 2 ) & If ( not IsEmpty ( suffix ) ; suffix ; " PM" ) ; "INVALID TIME" ) )

which parses any time entry into an appropriate format (eg 1030 becomes 10:30); donot replace existing value is UNCHECKED.

I want to add one minute to the previous FinishTime and have it enter into the StartTime. I tried this

GetNthRecord ( Main::FinishTime ; Get ( RecordNumber ) -1 ) + 60

which works only if I take off the Autoenter calculation above. If I leave that in, I get a ?mark in the StartTime field for the next case.

Sorry for the complicated post. ANy help appreciated

CHeers

Chris