FileMaker Loop Script

At the heart of FileMaker loop, it’s about having to flexibility to repeat the same repetitive action 10, 100, 1000, 10000 times using the exact same script steps.

Say you have a list of 3 people in your contact table. And you have a script like below to send 1 of the contact an email…

If you want use 1 single script to send all 3 contacts an email, you will need some sort of mechanics to “send an email, move to next record” for 3 times, something like…

Although this looks like a primitive approach, it certainly works. Simple solution for a simple problem, right?

But what if you have 10 contacts, are you going write 10x those lines?

What if you have 100000 contacts? What if you have 99998 for today and 99888 for tomorrow?

You can’t keep forever adding and removing script steps, that defeats the whole purpose of database automation.

To solve this problem, LOOP is the answer

The heart of looping is to have the flexibility to dynamically repeat your desired action X amount of time, depending the size of your records.

There are 4 elements to setup a successful loop in FileMaker.


In our case, here is what we want to do…

START from the 1st record.
Perform the ACTION of emailing a single person.
Then INCREMENT through the list of record by going to the next record.
And finally we STOP the looping sequence when we reaches the last record.

The result will look something like this…

Don’t understand a thing? Don’t worry. I will start explaining from the first element…

This means we START from the first record…

Moving on…

This is our loop area, whenever we place any action between LOOP and END LOOP. It will keep executing those action until we ask it to stop.

So in our case we are repeating 2 things

  1. The ACTION of emailing a person, and
  2. INCREMENT by moving to the next record.


The final element is STOP, by checking “Exit after last” to “On”, it instruct FileMaker to stop the loop when you reaches the last record in your table.

Since the starting point is record #1, and the stopping point is always the last record. This means it doesn’t matter if we have 10, 100, or 99997 records. The same exact script will run through the whole set of records and carry out your repetitive actions.

That is the rough basic concept of looping. If you want to learn in detail, check out the video at the top of this post.