Why does my Gallery.Selected change when I do a SubmitForm? I've noticed that this issue only occurs when my gallery is sorted. Is there a way to stop this? Is there a way to prevent my gallery from resetting when I do a SubmitForm?
When the "Items" for my gallery is this ...
... the issue occurs, but when I remove Sort(), I don't get the issue.
No it didn't work for me. The selected item just goes blank after I do a submitform. I tried setting it up another way and checked the "currentRecord" data and see that it is indeed set to the one I selected before, but for some reason the gallery.selected goes back to it's first item. Like the "currentRecord" has the item 1075 in its data but the gallery.selected is for 1076.
Gallery.Selected is always causing problems for me so I just don't use it.
Instead in the gallery do OnSelect=Set(varSelected, ThisItem.Title) and then for the Form you can have on the Items=LookUp(DataSource, Title=varSelected) and you can also filter other Galleries off that or use it however you need. It is a global variable then so works across screens and won't change what is selected off of other actions. If you Title field isn't unique do the ID or something else instead...a unique value.
I agree with the above but use Lookup(SPlist, ID=Gallery1.Selected.ID) as the Item prpropriety of the form. This guarantees a unique value is used for finding the correct record.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!