It's a bit vague. Almost all scripts that use Loop use one of two ways to control when the loop should be exited:
Exit Loop If [ ]. If the expression in the brackets is true (just like the If step), the loop is exited at that point.
Go to Record/Request/Page [next ; Exit after last]
This step moves you to the next record in your found set unless you are already on the last record. If you are on the last record this step causes you to exit the loop.
(Once upon a time, the ONLY branching script available in a Filemaker script was Go to Record with the exit after last step. I can recall using it in place of an IF step, which did not yet exist, if you can imagine...)
I think I understand.
Exit Loop If [ ] what do i put in this function?
Also how do you set a field as a variable: I am assuming you use the LET function
Since you are looping through records, apparently, you may not need exit loop IF step at all.
I need an understanding of what exactly you need the loop to do and under what conditions it should stop looping.
The loop will re-run the the script through all the records ie 4 records will have 4 loops
Conditions to stop looping - exit on the last record!
Should I just set the Records::fields variables from within the script
And what besides looping through the records will it do? (Maybe a loop is not even needed.)
The basic structure for looping through records in your found set looks like this:
#Perform a find, use go to related records or something to produce a found set of the records you want to loop through first
Go to Record/Request/Page [First]
#Do stuff here with the current record
Go to Record/Request/Page [Next ; Exit after Last ]
But please note that I have assumed a number details that may not be true for your situation. It might be that the records you want to loop through aren't the only records in your found set, for example.
sorry if im not being clear as Im only learning the proper fm terminology!
what the repeating script is doing is drawing a graphic (using 3rd party plugin functions) in a container based on the data in my table
each record in the table refers to parameters used by the plugin functions. some times there will only be one record and usually max 6 records
Each record uses exactly the same fields and script
And what script step do you use with those third party plug in functions?
Whatever they are, they would be placed inside the loop right where I have: "#Do stuff here with the current record".
I have run into a little problem!
I cant use last record in the loop, is it possible to set (go to record) by calculation instead?
ie go to record (last) -1
Please explain that in more detail. Why can't you use the last record? Can you omit it from your found set?
Another option is to do this inside your loop:
#Do stuff with current record here
Go to Record/Request/Page [ Next ]
Exit Loop If [ Get ( RecordNumber ) = Get ( FoundCount ) //true only when you are on last record ]