2 Replies Latest reply on Aug 25, 2010 10:38 AM by philmodjunk

    How to copy one record to a globals copy for editing?



      How to copy one record to a globals copy for editing?


      Got a bunch of users who may need to edit contact information. Client wants them to have to confirm any changes (and make it difficult to accidentally delete data). So I have made a copy of the table but as globals, and my plan is to copy the data to the globals for editing, then they have to confirm the changes, then I copy the data back. So I'd like to copy one record without losing their place in the found set. I tried: new window, show all records, omit current record, show only ommitted records, then new window, switch to globals layout, then import, hoping to grab one record but it is trying to grab all records. I don't want to export a swap file to local computers. Any suggestions how to do this?

      I suggested we use a script trigger upon entering or exiting a field but that would be annoying for editing address with multiple fields. Also there is the problem without confirming each field if they decided not to complete the change then the original data would be lost?

      Alternate suggestions welcome.

        • 1. Re: How to copy one record to a globals copy for editing?

          This might work:

          First, prevent the user from entering fields in the Contacts layout (click each field then go to Inspector > Data tab > uncheck "Browse Mode" in the "Field entry" section. Do this for every field in the Contacts layout.) This should prevent "accidental" modification of the original data, so that if the user REALLY needs to edit data they will have to click an "Edit" button.

          Then create two scripts that basically do the following:

          Script 1 (attached to an "Edit" button on the Contact layout)

          1. Use a series of Set Field steps to set the various Contact fields of the current record into the corresponding global fields.

          2. New Window

          3. Go to the layout with the global fields where user can edit the data.


          Script 2 (attached to a "Done" button on the global fields layout)

          1. Show Custom Dialog to warn user that data in the current Contact record will be overwritten

          2. Use a series of Set Field steps to set the global fields into the corresponding Contact fields of the current record.

          3. Use a series of Clear steps to clear all the global fields (this step isn't really necessary but it might be good for your peace of mind to know that the global fields are always "emptied" after a user has finished editing)

          4. Close Window


          With this method, there would be no need to isolate the current record or to "import" data into the global fields. The Set Field steps should take care of everything.

          It would be a good idea also to have some "housekeeping" fields that keep track of the date/time that a Contact record was last modified and the user who modified it.

          I'm not sure, however, what would happen if two users were editing the global fields at exactly the same time. Perhaps the FMP gurus on this forum can answer that, or perhaps they can suggest a better solution altogether.






          • 2. Re: How to copy one record to a globals copy for editing?

            The nice thing about using global fields in a shared database is that each user gets their own set of global fields to play with. Changes made to a global field by one user will not be seen by another and the values in global fields revert back to their original values when the user closes the file unless the change was made from the host computer.

            One issue to think about though is that this approach short cuts any record locking. If two users decide to edit the same record at the same time, whoever saves last will overwrite all edits from the other user.