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 / How to keep selected g...
Power Apps
Answered

How to keep selected gallery item after updating?

(0) ShareShare
ReportReport
Posted on by 51

Questiong.png

When I update item, selected gallery item is changed, but i want to keep this.
Could you let me know why it happened and what is the solution ? 

 

Thank JH

Categories:
I have the same question (0)
  • Verified answer
    eka24 Profile Picture
    20,925 on at

    On the OnVisible of the screen, Create a variable;

    Set(MySelected, GalleryName.Selected)

     

    You can use the variable: MySelected anywhere in your App.

    Edited:

    You can set the Default of the Gallery to:

    MySelected

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • JHChoi81 Profile Picture
    51 on at

    It has same problem. 

    1. Gallery1 -> Items : 

    SortByColumns(

    If(TextInput1_3.Text="" && TextInput1.Text="",

                     Filter(FixtureMasterList,Applied = ddFixtureType_3.Selected.Result && FixtureName=Dropdown1_1.Selected.Result),
    If(TextInput1_3.Text="",
                     Search(FixtureMasterList,TextInput1.Text,"FixtureName"),
                     Search(FixtureMasterList,TextInput1_3.Text, "FixtureNum"))),
                                                                                                                "FixtureNum",Ascending)

    what is wrong ? 

     

    JH

  • eka24 Profile Picture
    20,925 on at

    The procedure I stated is the way to go. However remember you have about 3 criteria using If function. So if the variable does not Fall into the criteria, it may not work. 

    Can you give a screenshot of the formula I gave

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • JHChoi81 Profile Picture
    51 on at

    Untitled1.pngUntitled2.png

    I don't know what is wrong.... 

  • eka24 Profile Picture
    20,925 on at

    I cant see the Variable in the Default of the Gallery, you have rather put the FixedMasterList there.

    The suggestion was to create a variable onvisible and put the variable on the default.

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • JHChoi81 Profile Picture
    51 on at

    Sorry,

    I've followed your recommend.

    But, it also has same problem. 

     

    OnVisible : Set(MySelected,FixtureListMain_2.Selected)

    Untitled3.pngUntitled4.png

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @JHChoi81 ,

    Based on the screenshot that you mentioned, I found that your second Gallery (Gallery1) has been bind to the selected item in your First Gallery (FixtureListMain_2), right?

     

    According to the issue that you mentioned, I think this issue is related to your UpdateIf function. When you execute your UpdateIf function successfully, your FixtureMasterList data source would be refreshed, then your First Gallery FixtureListMain_2 would also be reset. So the FixtureListMain_2.Selected formula would be reset to the first record in your FixtureListMain_2 Gallery.

     

    As an fixed solution, please take a try with the following workaround:

    Set the OnSelect property of the FixtureListMain_2 Gallery to following:

    Set(CurrentSelectedItem, FixtureListMain_2.Selected)

     

    Set the Items property of the Gallery1 (second Gallery) to following:

    Filter(FixtureMasterList, ID = CurrentSelectedItem.ID)

    remove the formula from the Default property of the Gallery1.

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • pwagma Profile Picture
    45 on at

    This is an interesting solution, but the problem for me it comes when I modify the data. The source gets updated but not the variable, what I am missing?

    Thanks

    Pablo

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard