mattc Posted November 10, 2006 Posted November 10, 2006 Hello There Can anyone help me please... I have a multiuser FMP7 DB used for call logging. We have recently added the getmail & sendmail plugins to 'pipe' calls directly into the DB (which works great), however i'm having some trouble extracting data back out to use sendmail due to record locking. Users are editing records all the time and when a record is created, a mail is meant to be sent to our customer. I have created global fields which are poulated using the set field command with the relevant info to be sent. A script then runs every minute to see if there are any new mails to be sent. If one of our users is editing the record at the time, I want filemaker to detect that the record is locked/being modified and wait until the next loop when it isn't locked. I have tried error trapping for this using error codes 300 and 301, however this doesn't seem to work. If I get(last error), it shows a "0" which means it didn't detect one (however the record being modified error shows on screen). Is there another way to tackle this where maybe FM can request a record lock, then exit script if denied and wait to try again next loop? Hope this makes sense Cheers Matt
Genx Posted November 10, 2006 Posted November 10, 2006 If the error is popping up on screen it implies that you haven't turned "Set Error Capture[On]"... Unless you turn this on, Get(LastError) will always return 0 - when you do turn this on, the dialog shouldn't pop-up even if there is an error.
IdealData Posted November 10, 2006 Posted November 10, 2006 I use ana lmost identical method of distributing modification notices to users, however I write new records to another file, which is the content I want to send. As I am always adding records then there are no record locking problems. I also have a "slave" computer checking every minute for the "waiting"messages.
IdealData Posted November 10, 2006 Posted November 10, 2006 (edited) If you want to pursue the error trapping method then here are some golden rules: 1. You must enable error trapping with a Set Error Capture [On] step. 2. You must test the error IMMEDIATELY after the script step executes. Watch out for COMMENTS as they may influence the result of the last error. 3. If a user is in a script during data entry and the script is trapping for errors then the user won't be able to edit the record if it is locked, but will also NOT be advised that the record is locked (because the error is being trapped). HTH Edited November 10, 2006 by Guest
mattc Posted November 10, 2006 Author Posted November 10, 2006 Thanks for the help guys... Looks like it was a schoolboy error! My error trapping line wasn't the very next script step. Plus FMP7 caught me out with the record locking - it now allows entry to a field but doesn't lock it until input is made. Might be back if I encounter more probs Thanks again Matt
Recommended Posts
This topic is 6590 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now