I appreciate everyone that is trying to find a work around. I already have one, by just using my old method of fetching the records.
I posted this to let anyone that is using a SQL Select statement know that under some cirumstances the returned set of entries do not match what was actually selected. My libraries are somewhat complex, so I made a simple example to demonstrate.
You can reproduce this problem yourself by taking one of your existing libraries, add a checkbox field to it, then enter the script (changing the library name and column name in the script to whatever you are using). Place the script anywhere you want (I made it a "Library Action" myself). Check your new checkbox in a couple of entries, then run the script twice. You probably will see the "count" of returned records be the same between runs, even though the script as written resets that checkbox during the first run.
var ssql = "SELECT * FROM <yourlibraryname> WHERE <yourcolumnname> = true";
var entries = sql(ssql).asEntries();
var cnt = entries.length; // (Added for debugging)
message(cnt.toString());
for (let e of entries) {
e.set("<yourcolumnname>", false);
}
I have a simple library ready for Vasily should he request it. However, there may be something to a particular library, because when I was preparing a demonstration library from one of my existing libraries, the first one would not fail consistantly, but the second one did (the second had more fields).