Experiences of a FileMaker Pro Database Developer

Loopy Windows

This might be obvious to many, but sometimes the obvious just isn’t so obvious especially if you are deep in your project.
I have a list of records that have 12 fields that I needed to split into 12 separate records within the same table. I wrote a script to loop through the original records and create 12 new records for each one of the originals.
I spawned a new window to create and dump the new records into, so I could loop through the original set of records. This worked fine in my testing, but for some reason I must have “found” the records for my test. I just didn’t realize I did.
If the original window is showing all records, any records you create in the newly spawned window will update the original window. I guess this makes sense since you are showing all. It just took me a while to figure out that this was the problem. The result, in my case, was an infinite loop.
Lesson learned: If you want to run a looping script on all records in a table, and this looping script creates new records in same table, MAKE SURE YOU DO A FIND FIRST. Even if that find is suppose to find all. Don’t use Show All.

Post to Twitter

Speak Your Mind

*