• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

LrCollectionSet:delete() has no effect

Community Beginner ,
Feb 06, 2020 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

206

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
community guidelines
LEGEND ,
Feb 06, 2020 Feb 06, 2020

Copy link to clipboard

Copied

LATEST

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.

Votes

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
community guidelines