Copy link to clipboard
Copied
Hello,
I am trying to delete collection set programmatically. For this I've wrote this kind of code in LUA:
local collectionSets = scatalog:getChildCollectionSets()
for i = 1, #collectionSets do
if (collectionSets[i]:getName() == properties[_parent]) then
catalog:withWriteAccessDo('Move project collections to new parent', function()
collectionSets[i]:delete()
end)
end
end
But this hasn't any effect, the collection set still existing.
What do I wrong? Or is this not supported?
Thorsten
Copy link to clipboard
Copied
I just successfully tested similar code in LR 9.1 / Mac OS 10.14.6:
for _, set in ipairs (catalog:getChildCollectionSets ()) do
if set:getName () == "_First" then
LrDialogs.message ("Deleting " .. set:getName ())
catalog:withWriteAccessDo ("Deleting set", function()
set:delete()
end)
end
end
So are you sure the boolean condition of the "if" is evaluating to true? Insert the LrDialogs.message() line as shown above to verify.