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 / My selected gallery it...
Power Apps
Answered

My selected gallery item is resetting once I press a button

(0) ShareShare
ReportReport
Posted on by 302

Hello there!

I am pressing on a button and somehow the selected gallery item is different than before... how is that possible?

I select an order on screen1, it takes me to screen2 where it has shown details about that order.

I then click on a button to make a pdf and patch some stuff to sharepoint, when its done, the selected gallery item changes. 

Here is the OnSelect, it has nothing special;

What could be causing this to happen? Maybe because it is running a flow in Power Automate, it loses the selected item? I've commented out the flow part and it still happens. I don't know why...

Edit:
I commented out the patch part and that was it..... how and why is the selected item gone when patching something? And how can I avoid this?

 

 

Set(popupVisible; false);;
Set(popupVisiblePDF; false);;
Set(popupVisibleAkkoordVinken; false);;
Refresh(OpleverChecklistProgress);;

'Opleverapp-PDFChecklist'.Run(
 HtmlText1_1.HtmlText;
 OrderGallery.Selected.Result & "-" & SubOrderGallery.Selected.Result & "=" & lblUniekNummer2.Text & "-checklist" & ".html";
 OrderGallery.Selected.Result & "-" & SubOrderGallery.Selected.Result;
 lblUniekNummer2.Text
);;

Patch(
 'D-Nummers-OpleverApp'; LookUp('D-Nummers-OpleverApp'; Order0 = OrderGallery.Selected.Result && UniekNummer = lblUniekNummer2.Text);
 {
 ExternLinkFotos: "https://straatmanbv.sharepoint.com/sites/StraatmanApps/FotosOpleverappExtern/" & OrderGallery.Selected.Result & "-" & SubOrderGallery.Selected.Result & "/" & lblUniekNummer2.Text;

 'AlleMemo''s': ""
 }
);;

Set(popupVisiblePDF; true);;
Set(popupVisible; true)

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,380 Most Valuable Professional on at

    Hi @efeewfew ,

    Are you running the button from inside the gallery? If so, it will reset any changed items that are not part of the Items on load.

     

    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.

  • efeewfew Profile Picture
    302 on at

    Thank you for your answer @WarrenBelz 

    The button is not inside of the gallery, so still not sure why it is happening

    But if I select an order on one screen and go to the other screen, it should still save the old selected item right? Really weird how it is changing once I press that button

  • WarrenBelz Profile Picture
    156,380 Most Valuable Professional on at

    @efeewfew ,

    Very strange - what else do you have that could either reset the gallery or the data that form its Items?

  • Verified answer
    efeewfew Profile Picture
    302 on at

    @WarrenBelz  Nothing at all... It's just that code. 

    I've fixed it by just setting a value equal to the selected ordernumber and replacing the "gallery.selected.result" to the value

    Thanks for your help though! @WarrenBelz 

  • WarrenBelz Profile Picture
    156,380 Most Valuable Professional on at

    @efeewfew ,

    I assume this was the Item of the Form - anyway I am glad you got is sorted.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard