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 :
Power Apps - Building Power Apps
Answered

How to reselect the previously selected item in a gallery before collection rebuilt

(0) ShareShare
ReportReport
Posted on by 31
Hi there,
I am trying to solve the following problem. I have a gallery galMain connected to a collection collMain. The collMain collection contains a column with the unique textID for each item. My app is created like this: the user selects an item from a gallery, and the selected item's textID is automatically saved into a variable called varLastItem. Then the user provides some data, patches the SharePoint list, and the collection collMain gets rebuilt. After this rebuilt, the gallery of course selects the item which is defined in gallery's Default property.
 
My question is - how can I reselect the last selected item when I have its ID stored in a variable? My idea is to set a Default property of the gallery to something like this:
If(IsEmpty(varLastItem)=true,{},???)
Unfortunately I don't know how to define the ??? part of the function properly. Maybe there is even better solution to my problem?
Thank you so much for your replies! :)
I have the same question (0)
  • Verified answer
    ronaldwalcott Profile Picture
    3,827 Super User 2025 Season 2 on at
    How to reselect the previously selected item in a gallery before collection rebuilt
    Something like this
     
    If(!IsEmpty(varLastItem), Lookup(yourTable, varLastItem = whateverID))

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 624 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 381 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 225

Last 30 days Overall leaderboard