Hi Folks,
I'm trying to delete all items in a list that fullfil a certain criterion. In my case a specific value in one of the fields.
My first choice for this was a for-each-loop.
Obviously inside the loop I can not delete the item as it gets all messy with the IDs and skips every second item.
(After deleting item 1 it deletes item 2, but due to item 1 missing, the former item 3 has become item 2 - I hope this makes sense)
Now I've gone ahead and worked around this by looping through the items and writing their ID in a separate smart-object. In a second loop I go through the second smartobject and delete all items on the main smart-object whose ID is in there.
This works but is obviously way suboptimal. Having the second smart-object lingering around in my db is really not pretty.
Also it could turn into a perfomance issue as the list of items to delete is never emptied and just keeps piling on and looping through the whole thing.
To empty the auxilary smart-object, I'd have to the same thing again and figure out a way to delete all items.
Anybody got an idea on how to do that properly? I'm at a loss...
System: K2 4.7 August 2017 Cumulative Update
Thanks in advance and take care,
Alex