First let me say I love FileMaker Go. I have been waiting for this for a long time. I can’t wait to start deploying on it but right now I need to get the word out about what happens when FileMaker Go is sent to the background by an incoming phone call, or by the user tapping the home button.
This is really only a problem for large complex solutions doing lots of scripted data manipulations. Most simple solutions will just plain work. But if you have a large solution, you really do need to understand where you could run into some problems. Read on for what to do.
Here is the rub. when FileMaker is sent to the back ground any scripts that are running are simply terminated. Any uncommitted edits are simply lost. Read on for more info.First let me say that all of this is based on some testing I did while flying back to LA. I need to do more testing. But what I have found so far fits with my understanding of how the FileMaker engine works.
The following results apply to both FileMaker files that are stored on the iPhone/iPad, or ones that are accesed on the server. When FM Go is moved to the background either by the phone ringing or touching the Home Button, scripts that are running maybe terminated.
I say maybe because I am not sure if the scripts will have some period of time to complete, or if they are immediately killed. But either way scripts can definitely be terminated. When this happens any uncommitted edits that the script has made is lost. It is as though it never happened. The script just dies. Also important to note is that On Close Scripts do not run. The file is not actually closed.
This means that if you have a script that edits more than one record and does not batch the edits into a single commit, FM Go could cause you some problems. If the phone rings in the middle of that script some of your changes will occur and some will not. There will be no error. It will just leave your data out of whack.
Luckily you can write your scripts in such a way that you can avoid this problem. If you batch all your edits into a single commit then even the phone does ring you data will be ok. It will be as though the script never started.
I have been doing transactional scripting in FileMaker since FileMaker 7 shipped, and I can say that you can almost always re-write a script to be transaction safe. I say “almost” because I have found a few cases that had to be broken into two transactions. These had to do with situations where I had to delete as well as create and modify records at the same time.
I don’t know what other information is forthcoming in the tech briefs tomorrow that may help shed some more light on this but from what I can gather this is the current state of affairs.
Also let me say that I think this is probably the best job that FileMaker could do given the situation. The iPhone OS does not give them a lot of options. Killing the script and discarding any uncommitted edits is the right thing to do given the circumstances I am sure I will have more to say in this later.
Thats all for now. The plane is going to land soon. :>)