5 Replies Latest reply on Jan 11, 2011 7:07 PM by DA

# Auto fill calculation

### Title

Auto fill calculation

### Post

I have a field named "start time".  I would like to have each added record automatically add 30 sec to the first start time.  An example would be 1st record start time 00:01:00, 2nd record start time 00:01:30, 3rd record start time 00:02:00.  The only way I can see to do this is with a calculation, but I can't seem to come up with a formula that works.  Any suggestions would be great.

Thanks

• ###### 1. Re: Auto fill calculation

Hello,

Just tell me the 1st time is given by the user or it takes the current time and also you are creating record manually or by a new record button.

Thanks

• ###### 2. Re: Auto fill calculation

obviously u need to do this by making use of a calculation. It can be like:

you create 3 hidden fields(say ss, mm, hh)

Now for each field set its auto calculation as follows :

for field ssIf(Get(RecordNumber)=1;"00"; If(ss + 30 ≠ 60; ss + 30; "00"  )  )

for field mm : If(Get(RecordNumber) = 1; "00" ;  If(ss = 30; mm; If(mm + 1 ≠ 60; mm + 1 ; "00")   ) )

for field hh : If(Get(RecordNumber)  =  1 or Get(RecordNumber) =  2 ;  "00";  If(mm ≠ 0;hh ;  If(Mod(Get(RecordNumber) ;60) = 1; hh + 1;hh             )                   )        )

now for the field say time, u can set auto calculation as : hh & ":" & mm & ":" & ss

Note : here ur fields ss, mm and hh are global, field time is not global. And also make sure to disable the check box "Do not replace existing value of fields", appeared at auto enter tab.

• ###### 3. Re: Auto fill calculation

Abhaya and Raj

Thank you both for taking the time to help me.  Abhaya the answer to your questions are; The 1st time would be entered by me, the user.  Most records would be imported from an Excel spread sheet, a few would be recorded manually, although I could use a button if that would make it easier.

Raj,

I will let you know how it works

Thanks,

• ###### 4. Re: Auto fill calculation

No need to separte time into hours, minutes and seconds. Time fields record time in seconds and then formatting set on the field converts it into whatever time format is needed. Thus, all you need to do is add 30 seconds to the previous record's time field:

IF ( get ( RecordNumber ) = 1 ; Self ; GetNthRecord ( TimeStart ; Get ( RecordNumber ) - 1 ) + 30 )

Set this up an an auto enter calculation for TimeStart, enter a time in the first record and each subsequent new record will enter a time 30 seconds later than the previous record.

• ###### 5. Re: Auto fill calculation

PhilModJunk,

Thank you so much, that was easy and it now does just what I wanted it to do.