Highlighted

LrCollectionSet:delete() has no effect

Community Beginner ,
Feb 06, 2020

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

 

Topics

SDK

Views

108

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

LrCollectionSet:delete() has no effect

Community Beginner ,
Feb 06, 2020

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

 

Topics

SDK

Views

109

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Feb 06, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...