2 Replies Latest reply on Mar 30, 2012 5:28 AM by jgm_1

    temporary locking of tables

    med

      Title

      temporary locking of tables

      Post

      As I understand it when you open a file (fp7) all the tables in it are opened and you can access each using an attached layout. I also understand that you can change fields on a layout only if contained in the main table not in related ones.

      My question is : one of the tables (say table 1) contains parameters and I do not want any body to be able to change its contents while another is working with a different layout which is used to compile information for a report and if table 1 changes during the process the report will produce erroneous results).

      How do I lock table 1 ? I could not find this any where in the documentations.

        • 1. Re: temporary locking of tables
          philmodjunk

          I also understand that you can change fields on a layout only if contained in the main table not in related ones.

          Actually you can change them. They can be treated in many ways just like a field defined in the layout's table.

          How do I lock table 1 ?

          For starters, see "Editing record access privileges" in FileMaker Help and check out this particular sub section: "Entering a formula for limiting access on a record-by-record basis".

          The trick is to set up an expression where you can set a "lock" on a table and then later "unlock" it.

          Define a relationship like this:

          Table 1::anyfield X LockTable::anyfield

          You create a single record in LockTable. Define a text field, LockStatus in it. On a locktable absed layout where you want to control the lock status, place LockStatus on the layout with a Locked, Unlocked radio button format.

          Now you can use this expression as the record access expression in Manage | Security... to control access to the table:

          LockTable::LockStatus = "UnLocked"

           

          • 2. Re: temporary locking of tables
            jgm_1

            I have a similar need, but I want table 1 to be locked/unlocked by a script step. Can this be done?