Brian Dunning's FileMaker Custom Functions

ExitLoop ( ExitValue ; LoopLevel )

Exits loop when $i = ExitValue

  Average rating: 4.4 (33 votes) Log in to vote

Arend van Asselt   Arend van Asselt
Easy to Work
http://www.easytowork.com

Share on Facebook Share on Twitter

  Sample input:
ExitLoop ( get ( FoundCount ) ; 1 )
  Sample output:
Boolean result and $i increments with loop

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

It can be used for a single loop or nested loops. It provides an unique $i value for every nested loop so you can use $i as a parameter in all your expressions in the running script.

By exit $i will be made empty so if you have a loop further on in the script you don't have to set $i before.

This example collects the ID's of a found recordset and shows $i three times in every main loop.

Loop
Exit Loop If [ ExitLoop ( get ( FoundCount ) ; 1 ) ]
Set Variable [ $list ; $list & GetNthRecord ( Evaluate(Get(LayoutTableName)&"::id") ; $i ) & ]
Loop
Exit Loop If [ ExitLoop ( 3 ; 2 )
Show Dialog [ “Hi I’m number “ & $i ]
End Loop
End Loop

 

Comments

Doug Staubach   Doug Staubach, Denver, Colorado, USA
Mar 22, 2015
These are good instructions for someone who wants to create a loop within a FileMaker Script. (However, just to be clear, the statements here will not work inside of a FileMaker Custom Function.)
 
Arend   Arend, Amsterdam
Mar 22, 2015
Hi,

Exit loop is the Custom Function and yes it will work properly!

The goal is that you can use $i as a counter several times in a script without setting $i to 0 for the next loop.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.