You don't need a loop to do this. You need a find. You can perform a find to find records or Omit records.
1. ) Enter Find Mode uncheck pause
2. ) Set Field to Treated to "Yes"
3. ) Omit Record
4. ) Perform Find
1.) Enter Find Mode Uncheck pause
2.) Set field to Treated to "No"
3. Perform Find
hahaha wow.. I was trying to do more work. Thank you!
But is there a way to do it with a loop, from what I attempted?
There is no reason to loop through all the records. You can create a script to perform the steps I stated above. Is there something else you are trying to accomplish?
No, not really. I was just trying to get used to the Loops and Ifs for Filemaker. I have used Java so I am familiar with the concept, but the two programs are different so I was trying to get to know it better. I guess my intention for using loops there was to see how to make the count variable increment by 1 each time it goes through the loop :)
So thinking through your looping "learn" script...
You set a global to zero, then go to the zeroth record...? Is there one? How does the script work if you simply gotorecord [first] instead?
and inside the loop you go to record [next, exit after last] ?
Loops in FileMaker scripts take one of two forms:
Exit step (two choices exist)
Is the commonly used format. Recursive script calls, however, can also produce a loop--either through perform script or by tripping a script trigger.
Your exit steps are either: Exit Loop If [boolean expression goes here, loop is exited if expression evaluates as true]
or: Go to Record/Request/Page [next ; exit after last] --> this step is used most often to loop through a set of records and automtically exit after the last record in the found set.
Here's an example that will loop 5 times:
//put the rest of your script code here
Set Variable [$K ; $K + 1 ]
Exit Loop If [ $K > 5 ]
Note that this simple structure can replicate the for next, repeat until and while loops of more traditional programming languages simply by where you put the Exit step within the loop.