Skip to main content
Inspiring
February 6, 2020
Question

LrCollectionSet:delete() has no effect

  • February 6, 2020
  • 1 reply
  • 242 views

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

 

This topic has been closed for replies.

1 reply

johnrellis
Legend
February 6, 2020

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.