web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Select item in Gallery...
Power Apps
Unanswered

Select item in Gallery1 from a button in Gallery 2

(0) ShareShare
ReportReport
Posted on by 112

Hi all.

 

I'm trying to create a mechanism where if I click on a button in Gallery2, it navigates to another screen and selects the associated item in Gallery1. The data is in CDS and there's a lookup field associating Gallery2's record with a record in Gallery1. I've got the navigation part covered, but I'm not sure how to select the specific gallery item. I know of Select(), but that requires a row ID and I'm not sure how to obtain that based on a value from a lookup column. Any ideas?

Categories:
I have the same question (0)
  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @ell10706 ,

     

    On the gallery item click you can set a variable Set(varSelectedItem,Thisitem) and can utilize this variable for any values from the selected gallery item. 

    Eg : varSelectedItem.ID will give you selected items ID

  • ell10706 Profile Picture
    112 on at

    Thanks, Priyanka. I guess I'm confused how I'd get the item's ID in the first place, since my search is originating in Gallery 2. 

     

    I.e. I select Item 1 in Gallery 2 (which is associated with Item 3 in Gallery 1). The screen should change to show Gallery 1 and select Item 3. 

     

    How can I derive the Item ID of Item 3 based on what I select in Gallery 2? 

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    @ell10706 

     

    Lets take it step by step 

    1. select Item 1 in Gallery 2 (which is associated with Item 3 in Gallery 1) - In the gallery 2 button where you are navigating to Gallery 1 add code

    Set(varSelectedItem,Thisitem)

    2. Gallery 1 and select Item 3.  - In the gallery 1 items Filter(gallery1item, ID=varSelectedItem.ID)

  • ell10706 Profile Picture
    112 on at

    Thank you, I'll give this a shot. I should clarify, the items from Gallery2 and Gallery1 are from different tables, but are related by a lookup field. Will this method still work?

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    @ell10706 

     

    Yes, It should work instead of ID mention the related field value. 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • ell10706 Profile Picture
    112 on at

    Sweet. I see what you're getting at here and it does technically work.

     

    I should clarify that both galleries are already filtered by a search box and drop-down, so adding this logic to the mix might complicate things. I also noticed that this won't select the item from the filtered gallery, just make it the only result. Users would still need to click on the item to view it (I show details about the item in a form adjacent to Gallery 1). Is there a way we can make the desired item actually selected within the gallery without adding additional filters?

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    @ell10706 

     

    Yes, you can. Please check the Is selected property of gallery and add the query there instead of Filtering the gallery1. 

  • ell10706 Profile Picture
    112 on at

    Got it, thank you. Are we talking about the OnSelect property?  I only see that and "Selectable" as properties in the gallery.

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    @ell10706 

     

    Sorry, If you add a rectangle in the gallery and try the below code in the Fill it should work. 

    If( Condition: SelectedValueGallery2=Gallery1,RGBA(255, 191, 0, 0.1),RGBA(255, 255, 255, 1))

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard