4 Replies Latest reply on Feb 3, 2016 5:54 PM by jeffro1120

    Date and time stamp


      OK so I am trying to make a time stamps button. I have a friend that wants it done a special way and I tried to change his mind but he wants it this way. There is a new note button. And a notes field. Having trouble with the Script though. It needs to do a user and date and time stamp excluding the seconds and the hard part for me is in the notes field it needs to move everything down 2 lines for separation and then do the name and timestamp at the top. Any suggestions? This is in FileMaker Pro 14.

        • 1. Re: Date and time stamp

          The solution to this is to learn string manipulation and concatenation, and how to deconstruct a timestamp using time.


          If the_field contains a string and you prepend two pilchrows it forces whatever the contents of the_field were down two rows.

          So Set Field ( the_field ; "¶" & the_field ) will drop the contents of the_field down two lines.


          This calc will get you the timestamp as text with seconds removed.

          Let (


          _ts = Get ( Currenttimestamp );

          _h = Hour ( _ts ) ;

          _m = Minute ( _ts )



          Left ( GetAsText ( Time ( _h ; _m ; 00 ) ) ; 5 )


          Not tested when hours is less than 10 or minutes is less than 10

          • 2. Re: Date and time stamp

            I must be missing something. I can get it to skip the line but the problem is it keeps going to the end of the field. I need it to start at the beginning. That is where I am having trouble. I need the info to look like this


            username timestamp - this is the third note


            username timestamp - this is the second note


            username timestamp - this is the first note


            essentially he wants to click a button and it start the new note information by moving everything down and inserting username timestamp -

            • 3. Re: Date and time stamp
              Markus Schneider

              (I would prefer to have separate records for every note)


              you can use coherentkris' forumula, just change the calculation part of the 'let' to something like

              get(UserName) & " - " & _h & ":" & _m

              instead of the 'left...'


              to have it step by step, just create a var with kris' formula (altered)


              set variable ($MyVar; kris_formula)

              set field (MyField; $MyVar & "PP" & MyField)


              PP stands for the two pilchrows, You set the note field to the new header and the contents of the note field. The script might need to set the cursor as well, might be different if the note fiekd is empty (first note), etc.

              • 4. Re: Date and time stamp

                Sorry about the late response but i eventually found the perfect solution it is as follows


                Set Selection [Customer::Notes ; Start Position0; End position0 ]

                Insert Text " press enter twice or 2 "

                Set Selection "Same as before"

                Insert Calculated Result "turn off the select entire contents"

                    Here is my calculation "--- " & Get(CurrentDate) & " @ " & Get(CurrentTime) & " by " & Get(AccountName) & " ---¶"


                Example of the notes field will look like so:


                --- 2/3/2016 @ 1:45 PM by Your User ---

                This is the note part the user would write


                --- 2/1/2016 @ 2:00 PM by Your User ---

                This would be an earlier note


                I attached this script to a button and it works great!!