What your missing in your Loop is the option of your Go to Record [Next]. Select that script step. On the left, near the button, is an [x] Exit after last option; it should be checked. Then the step will read: Go to Record [Next, Exit after last].P.S. You might consider adding a Go to Record [First] step before the Loop starts. Just in case you'd forgot to go to the first record before you started the script.Another thing. I almost always use the Set Field step instead of ones like Clear, Copy, Paste.Set Field [ a field; original field ] copies "original field" to "a field"Set Field [ original field; "" ] clears "original field"( By default it does what "select" does, all data in the field.)( I think I got it right :-)[ Do not test such changes on the real live file; as a mistake could clear data, if in a Loop. FileMaker Pro Advanced, with Script Debugger on is the safest way to see such.]
Fenton has given excellent advice.
To expand on it:
Copy, paste, clear and script steps that start with "insert" require that the field they reference be present and browse mode accessible on the current layout when they execute. If not, they silently fail to work. I thus avoid using them except when absolutely necessary. Set Field and Set Variable can be used in place of them in most situations and these steps will work even if the field is not on the layout at all.
In addition, Copy copies data to the system clipboard. This can irritate and confuse your users when data that they have copied is mysteriously replaced by data copied by your script. Use Set variable to copy the value to a variable and you won't need to use Copy in most cases.
Paste can then be replaced by a set field step that looks like this: Set Field [YourTable::field ; $VariableHere ] and you put the variable created by the set variable that you used in place of copy in place of $VariableHere.
Clear can be replaced by: Set Field [YourTable::Field ; "" ]
Insert Text can be replaced by Set Field
Insert .... steps, because they interact with your layout, also will trip script triggers such as OnObjectEnter or OnObjectExit where set field does not.
Fenton & Phil,
Thank you for your replies, I am not sure how I missed the exit on last check box (I looked like 20 times) and great idea for the go to first record I totally overlooked that.
In regards to the copy paste clear information, I had no idea they could be so troublesome if given the right conditions. For now I will leave the copy, paste and clear intact as they are working as expected in the live system. As I don’t have access to the advanced version to debug scripts it will have to wait to be corrected in the database until the next major update I do since I have to work inside of a copy and that a majority of the scripts rely on copy paste and clear at the present time.
The joys of working on someone else’s project from 10+ years ago when it was upgraded from a dos system….I'm, not sure whom has the best answer as they are both useful and correct.
Thanks again for all the time you guys commit to help novice people such as myself!