?
Solved

Is there a way to check if another user is currently in the record priot to running a script?

Posted on 2007-08-01
7
Medium Priority
?
350 Views
Last Modified: 2010-04-27
Is there a function or something I can use to check if a record is locked prior to running a script?  For example, I have a script setup to charge credit cards from data in FileMaker.  You push a button in the Invoice layout and it charges the card and returns data into FM via ODBC.

The problem is that if somebody else is in the record when you run the card you end up with a SQL error because the record is locked by another user.  I'd like to be able to check this immediately upon the button being pushed so that if the record is locked it will display a custom diag. and allow them to run it later when the other person is out of the record instead of running the card but not being able to return data.

I can't seem to find any functions for this.  Any info. would be greatly appreciated.  Thanks!
0
Comment
Question by:Andrew Angell
  • 3
  • 2
  • 2
7 Comments
 
LVL 6

Expert Comment

by:JoJohn2004
ID: 19613728
The Get ( LastError ) = 301 statement can be used for this. At the beginning of the script, go to any field in the record about to be changed. Attempt to change a field by, for example, using a set field to set it to itself. If there is someone already in this record an error code of 301 will be returned. Use the Set Error Capture script step along with an if statement to test for this error and branch accordingly.
0
 
LVL 11

Author Comment

by:Andrew Angell
ID: 19614515
Sounds good.  I'll play with that and get back to ya.  Thanks!
0
 
LVL 28

Accepted Solution

by:
lesouef earned 2000 total points
ID: 19628663
easier: Get ( RecordOpenState )
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Author Comment

by:Andrew Angell
ID: 19628722
ah, nice.  I was hoping there was something like that available.  I hadn't gotten a chance to play yet.  I'll come back and update when I do...it won't be long.
0
 
LVL 6

Expert Comment

by:JoJohn2004
ID: 19677928
Just a note about this. Although I have not tried it myself, Get(RecordOpenState) only works on the user's current session. It will not check the network. If you want to get the status of the network, you have to use the script step Open  Record/Request and then test for an error. At least that is what it says in Filemaker 9 Developers Desk Reference.
0
 
LVL 11

Author Comment

by:Andrew Angell
ID: 19678261
Yes, I discovered this but I had already awarded the points.  Sorry about that.  I should have waited until I actually got it working.  :(
0
 
LVL 28

Expert Comment

by:lesouef
ID: 19682039
sorry, no server here to check this...
you can ask for a refund or change for JJ , no pb for me.
BTW, I have to check, but there should be a SQL command to check the record status, but I am not sure in which SQL brand I saw this, maybe not mySql
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question