Cancel a FileMaker Script – with Easy Clean-up | the beezwax buzz

Had not thought of this angle – good tip!

Cancel a FileMaker Script – with Easy Clean-up

Posted by vince 09/21/2013 at 01:10AM

As FileMaker developers, sometimes we write scripts that take a long time to process data. Maybe it’s because we’re looping over many records gathering up a report. Or maybe we have set up a process — say for generating a new project, invoice or service order — that involves gathering up a list of tasks, and it takes time to do this.

Sometimes a user wants to stop things, right in the middle of the process! Little do they know that our script has only looped over 10 percent of the records, or set flags in half of them, etc.

What to do now?

Cancel a FileMaker Script – with Easy Clean-up

Well, what if there were a simple way to allow the user to cancel the script even in the middle of performing its task, then have another script take over and clean up as if nothing ever happened? If that is what you need then you are in the right place.

Of course, first you need to decide what kind of behavior you want your script to allow. There are many times when you need a script to complete all the way to the end, as if it were a transaction. In those cases you’ll want to have Allow User Abort [Off] and not allow the user to cancel the script. This is a different use case, and beyond the scope of this example.

But, in cases where it would be OK to cancel the script, as long as you ensure some way that clean-up happens, then this example will be perfect for you.

This is a simple example but you can very easily expand on it for any solution you have. Check out the demo file to see the script, and example of how to use it.

More… Cancel a FileMaker Script – with Easy Clean-up | the beezwax buzz.

Liked Liked
Need FileMaker Development Help? Or to purchase FileMaker Software?
Contact FM Pro Gurus for help