2 of 2 people found this helpful
You could, depending on what structures are in the script, trap on Get ( ActiveModifierKeys ).
Loops are great for:
If( Get ( ActiveModifierKeys ≥ 16)
If( get(lastmessagechoice) = 1
ExitScript or HaltScript //whichever is appropriate.
•Shift = 1
•Caps Lock = 2
•Ctrl (Windows) and Control (Mac OS) = 4
•Alt (Windows) and Option (Mac OS) = 8
•Command (Mac OS) = 16
"My belt holds my pants up, but the belt loops hold my belt up. I don't really know what's happening down there. Who is the real hero?" ~Mitch Hedberg
1 of 1 people found this helpful
If you set Allow User Abort to ON at the beginning of the script the user can press escape (win) or command (osx) to abort a script.
Allowing user to abort a script may leave the database in an invalid state.
Ref the C in Database ACID
You really need to be careful doing this.
+1 to what coherentkris said: "You really need to be careful doing this."
Unless there is an explicit reason NOT to, I alway include a "Allow User Abort [Off]" step. The FileMaker default is to allow the user to abort a script.
Plan for the problems, and prevent reasons why users would WANT to abort a script. Allow for exits, on your terms.
Allowing an abort while a script is looping through records on a "Developer Only, Full Access to Everything" layout can cause all sorts of problems, for instance.
What are you going to do about any records that might have changed before the script was stopped?
Hence my question about leaving the database in a valid state after the "transaction" is stopped or finished. There is alot to consider
Thanks for the answers !
My script will only compares records and when it find to records that are similar, it will notes the IDs in one of their fields.
Stephen's solution looks like a good idea but if there is a way I would like a more user-friendly way.
Also, I know it isn't always a good idea to abort a running script so the safest way would probably be to show a dialog box to the client (pausing the script) and if he press OK, it would set a global variable and resume the script. At the end of the loop, it would safely halt the script if this variable is set, so I know exactly where the script will terminate.
How do you determine if the records are similar enough? My guess is there's an easier way.
Tony, there is an FMP custom function (I have not tested) that may help:
Levenshtein ( str1 ; str2 ; damerau ; caseSensitive )
Custom functions need FMPAdvanced to install (create and edit), but can be used by FMPro. On occasion, I've used the formula to script the results, when FMPA is not available.
This sure seems like your BEST bet is to convert this process to something using Perform Script On Server (PSOS). Also, would it be true that once you've evaluated a record, you wouldn't need to evaluate it again unless something had changed?
Thanks beverly, I already implemented it my way but I guess I could speed up the process using this custom function !
dtcgnet; not quite, I am looking for duplicates clients, so a client can have more than one duplicates which it has to be compared to. Also, I iterate through the database more than once to get better results.
I'll try converting to PSOS
keep in mind that the link to the custom function require other custom functions (and it's stated on the page).