6 Replies Latest reply on Aug 10, 2010 12:05 PM by philmodjunk

    More Than 1 User Function



      More Than 1 User Function


      Hi there. This is probably within the forum, but i couldn't find it in a search. Maybe it's my wording.

      Anyways, i was wondering if there was a function (like a get-function) that checks to see if the record is currently being modified by a user.

      My issue is that i have a script that creates a record on a related table even if the record is currently being used by another user. This throws out the "User is modifying record" error, but still gives me a blank record in my other table. My users then don't wait for the other person to be done, come back later and throw in a new record, which leaves me with loads of incomplete records.

      I was wondering if i could validate it with an if script step first and avoiding all of this. I checked the filemaker function reference, but didn't find what i was looking for.

      This is probably a quick solve, so thanks for your help in advance.

        • 1. Re: More Than 1 User Function

          I believe this will work: (Test it to be sure)

          Set Error Capture [on]
          Open Record/Request
          If [Get ( LastError ) = 0 /* Ok to procede */]
          // do your scripted stuff here that you want
             Show Custom Dialog [''tell the user why this didn't work"]
          End If

          Open Record/Request will generate an error if someone else has locked the record or if the user does not have access privileges that permit editing the record.

          • 2. Re: More Than 1 User Function

            Exactly what i was looking for.

            • 3. Re: More Than 1 User Function

              Yes, after testing this is exactly what i needed.

              Just for general info, The error generated is 301

              A list of errors is here

              I just wasn't searching for the right words.

              You saved my butt again PMod

              • 4. Re: More Than 1 User Function

                You might also have been able to incorporate just the set error capture and Get ( lasterror ) portions of the script as you were getting the error message, you just didn't have a means of getting your script to handle the errors effectively.  You can also change the code to:

                Set Variable [ $ErrorCode ; value Get ( LastError ) ]

                and then test use the Number in $ErrorCode to respond to different error codes in different ways.

                The thing to watch is that Get ( LastError ) must take place immediately after any step where we want to trap for errors.

                (We could really use an OnError type of error handler in filemaker scripts!)

                • 5. Re: More Than 1 User Function

                  I thought of that solution as well.


                  And, i totally agree. I mean, i would have thought that it was already incorporated. Which is what i was looking for in the first place.

                  • 6. Re: More Than 1 User Function

                    I've already suggested as much on Filemaker's Suggestion form: http://www.filemaker.com/company/feature_request.html

                    Any who agree, can use this link to chime in with their own requests to that effect.

                    For those unfamiliar with OnError as it is implemented in languages such as Visual Basic,

                    On Error allows you to set up a portion of your script that executes whenever an error condition is encountered after any step in the script is executed.

                    You can thus have a single section that tests error codes and handles the results instead of starting the script with Set Error Capture and then using Get ( LastError ) over and over again within the script to test for error conditions.