Transactions Cheat Sheet
FileMaker Go has focused a lot of attention on writing scripts that can survive disconnects without hosing your data. Luckily this is pretty easy to do. I need to do a really in depth article on transactions very soon, but in the meantime I thought I would throw up this cheat sheet to help people, since I keep seeing the same couple of little problems over and over again. So here is a FileMaker Transaction Cheat Sheet.
Single Commit
Remember the primary goal is to batch all of your edits under single commit records step. That is the only way that you can be sure that the entire thing went through or not.
Image via Wikipedia
Allow User Abort Off
Make sure you do not allow users to abort the script. This has always been important, but with FM Go it gains even more importance. When FM Go is disconnected when a Script is set to Allow user abort OFF, it does not hibernate. This what you want. Other wise when the user starts up FM Go again, they might end up on the same layout with a bunch of edits waiting to be committed. This is almost certainly not what you want. You want the user to have to come back in and start over from scratch.
Make Changes Through Related Records
Make all of your edits, including deletes through portals or related records. Edits made to related are committed when the parent record is committed.
Error Trap Changes
When you edit a record, trap for errors. If an error occurs, revert the record. You must error trap for at least the first edit made to any record. You don't really need to error trap each an every set field.
Error Trap The Final Commit
Make sure you trap for errors on that final commit. This is the one that many people miss. But it is very important. There are lots of problems that can occur there. If there was an error there, Revert Record. Also don't check the "Skip Data Entry Validation" checkbox on the commit record step. I think that is a bad idea. If you have data that is Invalid why would you want to commit it?
Revert Record on Error
If there is an error at any of these steps, just revert record and all of your changes will be undone.
Thats the simple Transactional Processing Cheat Sheet. I will try to do some more in depth stuff in the future.
Additional Note
Although transactional processing is getting a lot of attention because of FileMaker Go, it is important to remember that this technique has always been critical for ensuring data integrity in complex solutions. FileMaker Go just increases the likely hood that you will encounter the need for transactional processing.
