4 Replies Latest reply on Jan 5, 2013 3:09 PM by philmodjunk

    Commit Records

    ClayReed

      Title

      Commit Records

      Post

           I have a simple filemaker file that allows me to manage assets. I have a contacts table with layout and an assets table with layout. Currently you add contacts on the contacts layout and then on the assets layout you select them in a drop down list to assign to the asset. To make this process a little easier I created a "quick add" pop up on the assets layout. By clicking a "+" button next to the drop down field a script is executed and a pop up is displayed which is based on the contacts table. The script sizes and centers the layout and creates a new record request. After data entry the user clicks "Close" and the pop up closes. Everything works great except one thing. If a user changes their mind and decides not to add a new contact and closes the pop-up a blank record is entered into the database. How can I change/add to the script so that if no data is entered then no record is created. I assume there must be something with the commit records function but I have no clue how to make it work. The attached image is the pop up window and the script I'm using.

      popup.jpg

        • 1. Re: Commit Records
          philmodjunk

               Pop up a window with a layout where the fields the user uses for this purpose are fields with global storage specified. Then have your script create a new record and copy the data from the global fields into the corresponding fields of this new record only if they do not cancel out of the operation.

          • 2. Re: Commit Records
            ClayReed

                 Thanks Phil this works great except one thing. How do I clear the global fields after creating the new record? When I click the button and get my "add person" pop up the global fields still display the data from the previous contact.

            • 3. Re: Commit Records
              gcatnine

                   in the popup, instead of using the contact field use global fields and create a new record, copying the global to the content fields  only when the user commit the new contact

              • 4. Re: Commit Records
                philmodjunk

                     Just use Set FIeld to clear each global field after moving the data into the newly created record.

                     Set FIeld [YourTable::Global FIeld ; "" ]