4 Replies Latest reply on May 22, 2012 4:17 PM by mk4482

    Auto enter date



      Auto enter date



      I have students come in and log in to a FMP 11 database and when they finish entering their information, there is a "Finish" button that then opens a new blank record for the next student.  I want this "finish script" to also enter the current date and time of the record that was just finished, not enter a date and time on the new record that is created.  The date and time fields are hidden from the students.  I am not quite sure how to configure this.


        • 1. Re: Auto enter date

          I don't think you need your script to do this. The date and time fields (or a single timestamp field) can be set up with an auto-enter option in field options to enter the date and time that the record was created and/or the date and time it was last modified.

          If you choose to use a script anyway, use:

          Set Field [Yourtable::datefield ; Get ( CurrentDate ) ]
          Set Field [YourTable::timeField ; get ( CurrentTime ) ]
          New Record/Request

          That way, the data is assigned to the current record before creating the new record. If your button currently refers to the New Record/Request step in button setup, you'll need to create the above script and use the perform script option in Button Setup to perform this script.

          • 2. Re: Auto enter date

            Beautiful!  I was using "Insert Current Date" which wasn't working.  Thanks so much!

            • 3. Re: Auto enter date

              The "insert" steps require that the field be physically present on the layout or they silently fail. (You have to specifically test for an error code or note that the field's value never changed to know that it failed.)

              That's why I avoid the Insert steps except when it is impossible to use an alternative.

              • 4. Re: Auto enter date

                Thanks for that explanation!  Now I know what I was doing wrong - and I appreciate your replying back with why my method did't work.