Beginner question - how to efficiently check if a photo is part of the selection

Dear all,
Sorry for this beginner question, however I don't know how to solve it and I'm sure that there is a quick and easy answer to this:
My target is to get all the "heads of stack" (photos with Position 1 in stacks) of the selection ("photos" below).
for i, photo in ipairs( photos ) do
  local photoName = photo:getFormattedMetadata('fileName')
   if photo:getRawMetadata( 'isInStackInFolder' ) then
   --Photo is in a stack
        local photoHeadOfStack = photo:getRawMetadata('topOfStackInFolderContainingPhoto')
        local stackPos = photo:getRawMetadata( 'stackPositionInFolder' ) -- get the position in the stack
        local photoHeadName = photoHeadOfStack:getFormattedMetadata('fileName')
        app:logVerbose("Photo nb ^1, name ^2 is in a stack with the position ^3", i, photoName, stackPos)
        if stackPos == 1 then
        -- photo is master of the stack
             stackTop[#stackTop+1]=photo
             app:logVerbose("Photo ^1 is top of the stack ^2", photoName, #stackTop)
             -- check if couple if correct
        elseif photos.photoHeadOfStack then
             app:logVerbose("Photo ^1 is in a stack, but not on top. Top of the stack already selected", photoName)
        else
             stackTop[#stackTop+1]=photoHeadOfStack
             app:logVerbose("Photo ^1 is in a stack, but not on top. Top of the stack ^2 - ^3 ", photoName, #stackTop, photoHeadName)
        end
  end
end
In the if structure in the middle checking the Position in the stack, if the Position is not 1, I would like to check if the photo heading the stack ('photoHeadOfStack') is part of 'photos'. I tried 'elseif photos.photoHeadOfStack then' and 'elseif photos[photoHeadOfStack] then' but it doesn't work ->this elseif is never true even if 'photoHeadOfStack' is part of 'photos'.
Is there anyway to have this check done without checking "manually" photos ?(via for example a for Loop)
I'm sure that Lua proposes this, but I don't know how...
I thank you for your Support!

    --[[ This code creates "stackTops", an array of LrPhotos that are the
    tops of all the stacks containing photos in the array
    "photos". ]]
stackTopSet = {}
for _, photo in ipairs (photos) do
    local stackTop = photo:getRawMetadata ("topOfStackInFolderContainingPhoto")
    if stackTop ~= nil then stackTopSet [stackTop] = true end
    end
stackTops = {}
for photo, _ in pairs (stackTopSet) do table.insert (stackTops, photo) end

Similar Messages

  • I forgot the answers to my security questions, how should i reset them because I am not getting the email to reset them?

    I forgot the answers to my security questions, how should i reset them because I am not getting the email to reset them?

    Contact the Apple ID Security site from http://support.apple.com/kb/HT5699 or call the AppleCare support number from http://support.apple.com/kb/HE57 and ask to speak with the Account Security Team.

  • I installed Nik:s suite of plug-ins for LR5 but for some reason not all of them were installed. In the end I uninstalled all of the Nik programs from my Mac but before I reinstalled them I opened LR5 again to check. Under "photo" and "edit in" the plug-in

    I installed Nik:s suite of plug-ins for LR5 but for some reason not all of them were installed. In the end I uninstalled all of the Nik programs from my Mac but before I reinstalled them I opened LR5 again to check. Under "photo" and "edit in" the plug-ins were still presented but no programs opened, of course. after reinstalling the plug-ins one of the programs appeared twice in the list but not the others. I´m going to reinstall them again and I´m wondering if there is anyway of erasing the links to the plug-ins under "photo" and "edit in" ???

    Wow that was really quick, thank you so much.  Im not sure at all which version it was because i said it was around 4 years ago he bought it.  I know it isn't under his username, since he's a PC person (ugh) so i know its probably registered to one of our actual names.  isn't there some way to look it up since we did register it, because I'm not even sure where the disks are from when we bought it (we've moved a lot and also have two storage lockers, i know i would have kept it with other disks) but my cd rom drive is actually broken on my computer as well ( i think it got stepped on and is now squished and won't eject or run disks.)
    So is there anyway they can look up that its registered to one of our names since we did register it when we bought and installed it, or do i really have to find the disk with some sort of proof of purchase (i know there would be no receipt after all this time)
    either way, ill do what you suggested to the best of my abilities and thank you so much for answering my questions, i can't even open the program as its incompatible and find out the info from that) so I'm in a bit of a pickle and your response was so thorough and it didn't seem to be posted long enough to even write a well researched response, thanks, all the best,
    sarucia

  • How to Add a parameter of currency exchange rate in the selection screen

    Dear Friends,
    How to Add a parameter of currency exchange rate in the selection screen with format (9999.99999). wich field i need to take.
    Thanks,
    Sridhar

    TCURR-UKURS.
    ~Suresh

  • I have LR from 2 through 4.4,  I am simply trying to adjust CR2s, and convert the them JPEG.  LR says my Perfectly Clear is expired but my update is up to date and all paid for.  What is Perfectly Clear and how do i get this puppy to be part of the team?

    i have LR from 2 through 4.4,  I am simply trying to adjust CR2s, and convert the them JPEG.  LR says my Perfectly Clear is expired but my update is up to date and all paid for.  What is Perfectly Clear and how do i get this puppy to be part of the team?

    Perfectly Clear is a 3rd party commercial plugin for Lightroom.
    http://www.athentech.com/products/plugins/
    Have you ever installed it as a trial in the past?

  • I purchased extra icloud space to store my photos, videos etc in a process to switch my phone, as my current one is broken. How do I know that my photos have gotten to "the cloud"?? Forgive me, I'm new to this process.

    I purchased extra icloud space to store my photos, videos etc in a process to switch my phone, as my current one is broken. How do I know that my photos have gotten to "the cloud"?? Forgive me, I'm new to this process. and did I do this correctly?

    Photos and videos in the camera roll are included in your iCloud backup.  Restoring the backup to your new phone will recover them.

  • 6th gen nano says i have used 3gb of other memory: how do i remove this and how do i find what is in that part of the memory

    6th gen nano says i have used 3gb of other memory: how do i remove this and how do i find what is in that part of the memory

    The operating system for the iPod, album art, databases, etc. all make up the "other stuff". Think of it as all the backstage things required to make your ipod work.
    i

  • Beginner Question: How to put 5 V on an output?

    Hi everybody,
    I am an absolute beginner here, a Biology student that has to do electronics in Labview now...
    I want to do as much of this myself as possible, but need truly beginners hints, hoping to be clever enough to put it together myself with your information.
    I need to control some outputs, and monitor some inputs. I am focusing on the outputs at the moment.
    Questions:
    How do I make a block in my block diagram that can put a variable voltage on an output? I need two controls, one that puts a voltage on an output of 0 to 10 V continuously, the other puts a voltage on an output of 0 to 5 V in increments of 0.1 V
    Any hints will be highly appreciated. I have Labview 6 to work with. Pointers like 'look at p
    age XX of the manual' will do, but descriptions here, or through my mail... anything will be highly appreciated.
    Thanks in advance

    In article <[email protected]>,
    "Erado" wrote:
    > That's the beauty of this, I am not entirely sure (yet) I am going to
    > get a good look of the setup in about a month, but they want me to
    > prepare a concept VI before then. To me that made little sense, but my
    > comments on it hit a brick wall...
    Well, for me and my past gigs this has been a very common situation. When
    I worked for telecom we would have to develop apps for instruments that we
    wouldn't receive for six months. Luckily we had the basic concept of how
    they were supposed to run and this was adequate for development. It
    sounds like you're in a similar situation.
    > What I do know is that over two of the terminals there is a 5V voltage
    > applied in steps of 0.1 V. So I should put in something that makes it
    > possible for me to control this output in 50 steps of 0.1 V.
    Lemme see if I understand you from this post and your first one. You
    would like to buid a user interface that includes the following:
    1) A boolean control that gives these two options:
    a) output a continuous voltage in the range of 0-10 volts b) output a
    ramping voltage starting at 0 (or 0.1) volts and ending at
    5 volts using 0.1 volt increments with a dwell time of x mseconds
    2) A boolean to stop the application
    (perhaps another one to pause it)
    3) Several numeric controls:
    a) numeric control for the output voltage b) numeric control for the
    dwell time (optional) c) numeric control for the voltage increments
    (optional) for if the
    user wants to use values other than 0.1 volts
    4) An indicator that shows what the measured output voltage is. This is
    good for verifying your output signal. A chart would be nice.
    This is a top down approach which is helpful for laying out the
    application's user interface. The next thing you want to do is build some
    subVIs to simulate your voltage signals. Once you get some hardware you
    can simply replace these simulation subVIs with the real ones that
    actually communicate the hardware.
    I'm not sure if your measuring the output voltage too. I kinda just
    assumed this but that would require another subVI. I won't tell you how
    to build the subVIs (I can't take all the fun out this) but I hope I've
    pointed you in the right direction.
    Merry x-mas!
    -Kevin
    PS: learn how to play with control references. they're very convenient
    when you need to update the front panel indicators with data from a subVI
    sitting in its own continuous loop. it avoids global variable abuse.

  • HT201250 how can I check that all photos have been backed up in time machine

    I have used Time Machine for the first time to back up my Macbook Air. Macbook Air's iPhoto shows approx 5200 pictures on file.
    How can I check that the external hard drive (Time Machine) has all 5200 saved correctly before deleting the photos from the Macbook Air ?

    The only way to check a back up is to do a restore of it.
    However, why are you deleting your photos from the MBA? If you do they will also be deleted from Time Machine eventually. TM keeps a rolling back up of your machine. It copies and maintains your additions and deletions. Eventually, these photos will be deleted from TM too. It's not an archiving app.
    Regards
    TD

  • Question:  How to edit and/or delete photos uploaded to web gallery?

    My Dad uploaded some photos to my web gallery without renaming the photos. Is there any way I can go in and edit and/or delete these photos? Sorry if it's a dumb question... I'm new to iLife '08 (really new to iLife in general)... and for the life of me can't figure out how to edit and/or delete these photos (without deleting the whole library).
    Thanks for any help!
    Ciao ~ Louie

    Guess I just answered my own question.
    For anybody else that may be wondering...
    From within iPhoto there is a "WEB GALLERY" tab in the left side menu. There you will see the name of your web gallery with a little icon that looks like an antenna. If you click on that icon... it will sync your web gallery photos that have been uploaded by other users into iPhoto. You can then edit and/or delete the photos within iPhoto and the edits will automatically change on the published web gallery (may depend on sync preferences... mine changed automatically).

  • Supuid Question: How do you make a new Photo Album on iPhone 3g?

    How do you make a new Photo Album on iPhone 3g?
    When I press photos, it just goes to a screen with Camera Roll and no other buttons to press.
    I have read one article that states to click the "Add" button, but I don't see an Add button or a + button.
    Thanks in advance...

    Thanks for the response.
    So, is there no quick way to put the Camera Roll pictures into an album?
    It seems I have to click on those, send to Mobile Me, then download to my computer and put in the folders I am syncing.
    Not every intuitive at all.
    Thanks again.

  • How to find if all items in a list containing the selected color

    Hi
    I'm using the code below to check what color the user has selected. This is only working when my item got one color. Now I would like to change my code so each item can have one or more colors (seperated by semicolon). I guess
    I have to use string.IndexOf but I don't know how to use it in the .Where scentence below to return all the items that got the selected color.
    Thanks, Sigurd F
    var sampleDataGroups = await SampleDataSource.GetGroupsAsync();
    sampleDataGroups = sampleDataGroups.Where<SampleDataGroup>(Item => Item.Color == KeywordColorList.SelectedValue.ToString()).ToList();

    If the Color property of the SampleDataGroup class contains a string with different colours separated by a semicolon you could use the following code to determine whether the KeywordColorList.SelectedValue property is amont these colours:
    var sampleDataGroups = await SampleDataSource.GetGroupsAsync();
    sampleDataGroups = sampleDataGroups.Where<SampleDataGroup>(Item => Item.Color.Split(';').Contains(KeywordColorList.SelectedValue.ToString())).ToList();
    Compilable sample code:
    var sampleDataGroups = new List<SampleDataGroup>
    new SampleDataGroup { Color = "blue"},
    new SampleDataGroup { Color = "blue;red;green"},
    new SampleDataGroup { Color = "red;green"},
    string selectedValue = "blue";
    sampleDataGroups = sampleDataGroups.Where<SampleDataGroup>(Item => Item.Color.Split(';').Contains(selectedValue)).ToList();
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

  • The memory on my MAC is full. It holds 4GB of RAM of which 79GB are photos. I would like to back up my photos to an external drive but just don not know how. I do not wish to use time machine. How do I back up my photo library, then delete the them t

    The memory on my MAC is full. It holds 4GB of RAM of which 79GB are photos. I would like to back up my photos to an external drive but just do not know how. I do not wish to use time machine. How do I back up my photo library, then delete them from my MAC to free up that 79GB? Thank you.

    Hi
    Just to clarify a couple of points in your post.
    RAM (memory) is different from hard drive space. You have 4GB of RAM, but that has no bearing on the amount of drive space you have, of which we know that 79GB are photos.
    If those photos are in iPhoto, you should be able to move the entire iPhoto Library, from the Pictures folder, to your external hard drive. You can just drag and drop. Do not have iPhoto open while you're doing this. Once it's done, you can double-click on the moved iPhoto Library file to associate it with iPhoto, so that the app remembers where the library is for next time.
    One more thing. When you move a file to a different location, and then delete the original, you don't have a backup. You still only have one copy. So if that external drive dies, you will lose all your photos. Time Machine is a very good way to prevent this from happening. You should dedicate a different drive for Time Machine backups.
    Matt

  • How to attach search help to a particular feild in the selection screen..

    Hi all,
    how can we put a search help for a field in the selection screen.
    i have to attach search help for this.
    SELECT-OPTIONS: s_xabln  FOR  qals-mblnr.             "GRS No

    Find out the respective search help and use like this...
    Parameters : p_pernr type pa0001-pernr MATCHCODE OBJECT prem .
    Here PREM is the search help for PERNR

  • How can i used pai in screen 1000 to change the select-options field?

    hi,all.
    I want used pai to change the select-options field,but it can't works.
    the mainly code is:
    REPORT  ZTEST99.
    TABLES :MARA,MAKT,MARC.
    SELECTION-SCREEN BEGIN OF BLOCK B0 WITH FRAME TITLE TITLE0 .
    select-options:s_matnr for mara-matnr,
                   s_werks for marc-werks MODIF ID ID1.
    SELECTION-SCREEN END OF BLOCK B0.
    parameters:p_flag as checkbox.
    at selection-screen OUTPUT.
       LOOP AT SCREEN.
       IF P_FLAG = 'X' .
       IF screen-group1 = 'ID1'.
             screen-input = '0'.
        ELSE.
          screen-input = '1'.
        ENDIF.
        MODIFY SCREEN.
    ENDIF.
        ENDLOOP.
    START-OF-SELECTION.
    CALL SCREEN 1000.
    when i click p_flag,then i want to change s_werks from OBLIGATORY to no OBLIGATORY.
    how can i realized?
    Thanks for all.
    Sun

    Hi ,
    change your code like this.
    Change in your code:
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    SELECT-OPTIONS : s_matnr for mara-matnr,
    s_werks for marc-werks MODIF ID ID1.
    SELECTION-SCREEN END OF SCREEN 100 .
    At selection-screen.
    if sy-dynnr = '100'.
    IF P_FLAG = 'X' .
    LOOP AT SCREEN.
    IF screen-group1 = 'ID1'.
    screen-required = '0'.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    else.
    LOOP AT SCREEN.
    IF screen-group1 = 'ID1'.
    screen-required = 1.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    my code :
    REPORT  Z50871_SELECTOPS_DYNAMIC.
    PARAMETERS : CH_EBELN AS CHECKBOX,
                 CH_VBELN AS CHECKBOX.
    DATA: V_EBELN TYPE EKKO-EBELN,
          V_VBELN TYPE VBAK-VBELN.
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    SELECT-OPTIONS : EBELN FOR V_EBELN MODIF ID G1,
                     VBELN FOR V_VBELN MODIF ID G2.
    SELECTION-SCREEN END OF SCREEN 100 .
    AT SELECTION-SCREEN OUTPUT.
      IF SY-DYNNR = 100.
        IF CH_EBELN = 'X' AND
           CH_VBELN = ''.
          LOOP AT SCREEN.
            IF SCREEN-GROUP1 EQ 'G1'.
              SCREEN-ACTIVE = '1'.
            ELSE.
              SCREEN-ACTIVE = '0'.
            ENDIF.
            MODIFY SCREEN.
          ENDLOOP.
        ELSEIF CH_VBELN = 'X' AND
           CH_EBELN = '' .
          LOOP AT SCREEN.
            IF SCREEN-GROUP1 EQ 'G2'.
              SCREEN-ACTIVE = '1'.
            ELSE.
              SCREEN-ACTIVE = '0'.
            ENDIF.
            MODIFY SCREEN.
          ENDLOOP.
        ELSEIF CH_EBELN = 'X' AND CH_VBELN = 'X'.
          LOOP AT SCREEN.
            IF SCREEN-GROUP1 EQ 'G1'
               OR SCREEN-GROUP1 EQ 'G2' .
              SCREEN-ACTIVE = '1'.
            ENDIF.
            MODIFY SCREEN.
          ENDLOOP.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN.
    IF SY-DYNNR = 1000.
      IF CH_EBELN = 'X' OR CH_VBELN = 'X'.
        CALL SELECTION-SCREEN 100.
      ELSE.
        MESSAGE I000(Z50871MSG) WITH 'Please select atleast one checkbox'.
      ENDIF.
    ENDIF.
    regards
    Sandeep Reddy

Maybe you are looking for