1 Reply Latest reply on Feb 3, 2012 9:55 AM by philmodjunk

    Can I prevent multiple users from viewing the same record at once?

    ScottMcMurtrey

      Title

      Can I prevent multiple users from viewing the same record at once?

      Post

      I know two users can't make edits or changes to the same record at once, but is it possible to prevent a second user from even viewing a record if another user is already viewing it?

        • 1. Re: Can I prevent multiple users from viewing the same record at once?
          philmodjunk

          It's theoretically possible, but can be tricky to set up in a way that is bullet proof.

          You could for example use a script to "open record for editing" that set's a field in the table to a value that is then used with other scripts from other users to exclude that record from their found set so that it cannot be viewed. This takes a number of changes to the user interface to plug all possible wholes--best approach being a custom menu so you can control the Show All and Show Omitted menu options.

          But this can be tricky should a crash or network glitch kick the editing user out of FileMaker as this will leave the record "hidden and locked".

          You can also use a script such as:

             Set Error Capture [on]
             Open Record
             If [ Get ( LastError ) ≠ 0 ]
                Omit Record
             End If
             Set Error Capture [off]

          In a form view layout with an OnRecordLoad trigger performing this script, it will drop the record out of the found set the first time the user brings it up.

          A more complext version of the above script could loop through a found set and omit all such records, but could result in a delay if your found set has large numbers of records.

          If this is to keep a new, but incomplete record from being visible, I'd set up a layout where all the data fields are global fields. I'd then add a "submit" or "save" button that validates all the data and then "saves" it by creating a new record and copying the data from the global fields into matching fields in the newly created record.