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

Community site session details

Session Id : HXa8OZvDKpxcUZL+kA3eeg
Power Apps - Building Power Apps
Answered

Defining a variable as a selected gallery item

Like (0) ShareShare
ReportReport
Posted on 16 Jun 2023 09:57:23 by

Hi, I am trying to define a variable so that when you select an item from the gallery it will fill in all the fields related to this gallery. I only have experience with drop downs for creating variables. To test the connection between the data from my MS list and the power app, I used a drop down. The gallery is also populated with data from the list. I would like to define my variable as the selected list item. So something like Set(TechVar ,LookUp('Technology Register_1',Title = ThisItem.Title.Selected.Value)) but this won't work. TechVar (my variable) was previously defined for choosing from the drop down but instead of selecting my item from the drop down, I would like to select from the gallery instead. 


Any help would be greatly appreciated, Thank you in advance 

  • Verified answer
    WarrenBelz Profile Picture
    148,894 Most Valuable Professional on 19 Jun 2023 at 20:51:13
    Re: Defining a variable as a selected gallery item

    Hi @Anonymous ,

    You do not need all of that

    Set(
     TechVar,
     ThisItem
    );
    Navigate(HOMEscreen)

    or you can use this if you selection sources have different field content on the same list.

    Set(
     TechVar,
     LookUp(
     'Technology Register_1'
     ID = ThisItem.ID
     )
    );
    Navigate(HOMEscreen)

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • Community Power Platform Member Profile Picture
    on 19 Jun 2023 at 13:10:05
    Re: Defining a variable as a selected gallery item

    Hi @WarrenBelz 

    I have got rid of the dropdown, this is the code from my gallery. This works partly as it succesfully allows me to navigate, however he variable isn't defined correctly as I can't use this variable to populate fields 

    Set(TechVar ,LookUp('Technology Register_1',Name =ThisItem.IsSelected))& Navigate(HOMEscreen)

  • WarrenBelz Profile Picture
    148,894 Most Valuable Professional on 16 Jun 2023 at 21:22:42
    Re: Defining a variable as a selected gallery item

    Hi @Anonymous ,

    The easiest way to explain is just to post the Items of both the gallery and combo box.

  • Community Power Platform Member Profile Picture
    on 16 Jun 2023 at 10:51:21
    Re: Defining a variable as a selected gallery item

    Hi @WarrenBelz I'm not 100% sure of the meaning of full field content, so I will describe what's in the gallery, so I individually added items to the gallery rather than making a table as I only had to put a few things in. The gallery contains values for every row of the selected columns: ie. i chose to display the image column, title column, status column. To do this (for the status column for example), I used the code: 

    ThisItem.Status.Value

    I'm not sure if my explanation initially was clear enough, so I will restate my aim. I would like clicking on the Technology Name in the gallery to do the same thing as the dropdown - ie to look up the information related to that Technology in the MS list and display it all on the related screens 

  • WarrenBelz Profile Picture
    148,894 Most Valuable Professional on 16 Jun 2023 at 10:42:00
    Re: Defining a variable as a selected gallery item

    @Anonymous ,

    Then assuming the Items of your gallery are based on the full field content 'Technology Register_1', (you have not used Add/Show/RemoveColumns ) the code I supplied last

    Set(
     TechVar,
     ThisItem
    )

    should set the same value from your gallery.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    on 16 Jun 2023 at 10:26:34
    Re: Defining a variable as a selected gallery item

    Set(TechvVar,LookUp('Technology Register_1',Title= Dropdown1.Selected.Value))

     

    @WarrenBelz this is how i defined the variable when i had the dropdown

  • WarrenBelz Profile Picture
    148,894 Most Valuable Professional on 16 Jun 2023 at 10:22:12
    Re: Defining a variable as a selected gallery item

    @Anonymous ,

    What you have not posted is how you set the Variable for the drop-down - I was guessing it was a single value. If you want the whole selected record from the gallery

    Set(
     TechVar,
     ThisItem
    )

    The proviso here though it that the Items of the Gallery and Combo Box contain the exact Table structure - if not you will get an error on this.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    on 16 Jun 2023 at 10:13:59
    Re: Defining a variable as a selected gallery item

    Hi @WarrenBelz this isn't working.  So when I had the dropdown, it displayed a list of all of the Title values from my MS list. These values are all present in the gallery. When the user clicks on the title from the gallery, I would like this open another screen, and fill in values. With the dropdown, I was able to fill in the values, but I would like to select a gallery item instead of using the dropdown

  • WarrenBelz Profile Picture
    148,894 Most Valuable Professional on 16 Jun 2023 at 10:03:59
    Re: Defining a variable as a selected gallery item

    Hi @Anonymous ,

    I am suspecting you are setting the Variable from your drop-down to a single text value - if form the Gallery, you just need

    Set(
     TechVar,
     ThisItem.YourFieldName
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2