5 Replies Latest reply on Apr 2, 2014 6:22 AM by timacadia

    Add new Entry Button

    timacadia

      so I'm trying to make a button that adds a new entry to the database. the button works fine as long as you don't have any entries to update before creating the new entry.

       

      e.g. So I have a date modified box. This is an auto fill box that puts the date the entry was modified into the table. A created by box, auto fills with the logged on ID of the person making the entry and a Description box.

       

      So if I set the date box to fill when the record is CREATED I have no problems, it adds the new record and displays a new one ready to fill, But I want this to have the date you last modified this record, this is where I run into issues if say you have typed into the description box then click the button, it performs the update on the modified date, and adds the new Entry BEHIND the one you are updating, basically putting an empty entry into the database.

       

      See pictures4-1-2014 1-00-50 PM.png4-1-2014 1-04-47 PM.png

       

      Very confused.

        • 1. Re: Add new Entry Button
          timacadia

          sorry forgot to add the content of my buttons script

           

          4-1-2014 1-10-48 PM.png

          • 2. Re: Add new Entry Button
            SteveMartino

            I dont see a 'Date modified box' on your layout, I see 'Created by' and 'Date Created'.

            I think the problem is your typing into the record, then creating & commiting a new record.

            You would need a field with timestamp modified.

            Create the new record with a button, then type in data then commit.

            • 3. Re: Add new Entry Button
              timacadia

              those are just the manually enetered names, I just didn't change them yet.   The Date box AUTO Fills when you first create the document, and it's set to change if you modify the Description box.  the Created by Auto fills with the UserID of the person logged into Filemaker  neither of these box's is editable by the user.

               

              The problem occurs if you type in the description box, then click the button to create a new record, without using enter or tab first to move to the next field, it adds a blank record when you click the button  (pressing enter or tab after changing the description box prevents this from happening but you cannot assume all users will do this).  if I set the date box to only auto fill on creation it does not do this.

              • 4. Re: Add new Entry Button
                keywords

                Why don't you just add a Commit Record step at the start of your script? That way, if there is a record active but not finalised it will at least be committed so that autoupdate stuff gets done before the rest of the script proceeds to create the new record.

                1 of 1 people found this helpful
                • 5. Re: Add new Entry Button
                  timacadia

                  ok I have (sortof) fixed this.  @keywords gave me the idea.  although your suggestion didn't actually work.  What I had to do was add a 1 second pause in the script, between creating the new record and adding the ticket number to the new record, this way the time stamp is NEWER that the previous record and so shows as the new record waiting to be added.

                   

                  So my script now looks like

                  4-2-2014 9-20-22 AM.png

                   

                  thankyou for helping me think this through