Script Looping FileMaker Portal Rows

From Dwayne Wright PMP - Certified FileMaker Developer
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

FileMaker loop scripts will cycle  a  set  of  script  steps  over  and  over  again  until  it  receives  an  indication  to  exit  the  loop.  Scripts  with  loops  are  one  of  the  main  ways  to  have  FileMaker  perform  tedious  tasks  on  a  set  of  records.  Not only can they save time from performing tedious tasks, they also can ensure the data being processed is in the same format. Many times doing repetitive and redundant data entry, the data entry person will make a mistake strictly out of boredom.

In this example, we want to show a simple technique. However I've had many a time that showing a simple technique brings the response of "I didn't know you could do that! That is so cool!"

You can write scripts that go from portal row to portal row and perform a task. These tasks can range from the simple ( like in our example file ) to the very complex.

In the example, we click a button and every day in the portal is moved to the next day of the week. Here are the specifics of the script.

Set Field [Global Counter, """"]
** clears out the marker field **
Go To Portal Row [ Select, First]
** goes to the first portal row **
** starts the loop through the 7 records **
Set Field [ self_universal::Date, self_universal::Date +1]
** moves the date up 1 in the current portal **
Set Field [ Global Counter, Global Counter + 1 ]
** moves our counter up 1, so we will know when we hit 7 **
Go To Portal Row [ Next ]
** goes to the next record **
Exit Loop If [ Global Counter = 7 ]
** exits the record when the counter hits 7 **
End Loop
Exit Record / Request
** exits the current record and the portal, so we can see our results. **

This example is the most basic use of scripting an action from one portal row to the next. You can build all sorts of more robust scripts to meet a variety of needs.

An example file can be downloaded by clicking (here)

BTW: A calculation can be used to determine what set of conditions need to be met to exit out of an established ScriptMaker looping routine. For example, you could have ScriptMaker count how many times it performs a loop. Then, you can have ScriptMaker perform an Exit Loop If step when the counter meets a calculated result.

More info about the author and FileMaker in general, contact me at

© 2008 - Dwayne Wright -

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc