5 Replies Latest reply on Feb 13, 2014 3:25 PM by philmodjunk

    Auto enter Field

    kentanderson

      Title

      Auto enter Field

      Post

           I have two fields one it start time the other is Stop time.  I need the Start time to automatically be the last stop time in each new record.  Thank you in advance

        • 1. Re: Auto enter Field
          philmodjunk

               This would be an auto-enter calculation set up on the Start Time Field:

               Let ( R = Get ( RecordNumber ) ;
                       If ( R > 1 ; GetNthRecord ( StopTimeFieldHere ; R - 1 )
                      )

          • 2. Re: Auto enter Field
            kentanderson

                 Do i enter this exactly in the calculation form.  Let ( R = Get ( RecordNumber ) ; If ( R > 1 ; GetNthRecord ( Stop Time ; R - 1 ))

                 I tried this and it said two many ()

            • 3. Re: Auto enter Field
              philmodjunk

                   Actually, not enough parenthesis:

                   Let ( R = Get ( RecordNumber ) ;
                           If ( R > 1 ; GetNthRecord ( StopTimeFieldHere ; R - 1 ) )
                          )

              • 4. Re: Auto enter Field
                kentanderson

                     I have zero understanding of how that worked, but it did.  Thank you once again you ROCK!!!

                • 5. Re: Auto enter Field
                  philmodjunk

                       Get ( RecordNumber ) returns the current record's position in the current found set. So if you have 5 records in your found set and then create a new record, R get's the value of 6--the record number of the newly created record.

                       If, Let, and GetNthRecord are documented in FileMaker help.

                       The if function is intended to keep from auto-entering data from a zero record that cannot exist and this keeps a ? from appearing in the field if this is the only record in your found set.

                       The let function simplifies things by giving me a way to avoid having to type in Get ( RecordNumber ) more than once.

                       GetNthRecord, when used in this context is also referring to the position of the records in the found set. So by referring to the R-1 record, where R is the number of the current record, it accesses data from the record just above the new record in your found set.