cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kbpartha24
Frequent Visitor

Gallery selection is lost when SubmitForm

Hello

 

The Gallery selection is changed when I edit a record and SubmitForm.

 

Please refer to this link

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Bug-Gallery-with-calculated-values-will-lose...

 

When will this issue be fixed.

 

I tried the following

 

https://powerapps.microsoft.com/de-de/blog/decouplingbrowsegalleryfromforms/

 

It was working before. When the powerapps got updated this is not working as expected. I cannot see the record data in my Display Screen

 

Please suggest how to fix the same

 

Thanks And With Regards

Partha

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @kbpartha24 ,

Do you mean that after you submit an edit form, the gallery's selected item will change?

Actually, the theory is the same as the issue that you posted.

Since the gallery's Items is AddColumns(..), after you submit a record, the gallery's selected item will be refreshed.

To deal with this problem, you just need to save the selected item as a variable. Set your edit form and display form's Item to this variable.

Even if the gallery's selected item will be refreshed after you submit a record, it will not refresh your variable.

I've made a similar test for your reference:

1)set the gallery's OnSelect:

Set(CurrentSelectItem,ThisItem)

set the gallery's Default:

CurrentSelectItem

2)set the edit form's Item:

LookUp(datasource,ID=CurrentSelectItem.ID)

set the display form's Item:

 

LookUp(datasource,ID=CurrentSelectItem.ID)

 

//please replace with your data source name, your unique field, I use ID as an example

 

Then your display form's item will not change after you submit form.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yutliu-msft
Community Support
Community Support

Hi @kbpartha24 ,

Do you mean that after you submit an edit form, the gallery's selected item will change?

Actually, the theory is the same as the issue that you posted.

Since the gallery's Items is AddColumns(..), after you submit a record, the gallery's selected item will be refreshed.

To deal with this problem, you just need to save the selected item as a variable. Set your edit form and display form's Item to this variable.

Even if the gallery's selected item will be refreshed after you submit a record, it will not refresh your variable.

I've made a similar test for your reference:

1)set the gallery's OnSelect:

Set(CurrentSelectItem,ThisItem)

set the gallery's Default:

CurrentSelectItem

2)set the edit form's Item:

LookUp(datasource,ID=CurrentSelectItem.ID)

set the display form's Item:

 

LookUp(datasource,ID=CurrentSelectItem.ID)

 

//please replace with your data source name, your unique field, I use ID as an example

 

Then your display form's item will not change after you submit form.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PhilD
Kudo Kingpin
Kudo Kingpin

This straight-up does not work! Used precisely the same thing and will not work.

PhilD
Kudo Kingpin
Kudo Kingpin

Tested this just now, the problem has to do with a gallery that has the Search() function as part of its items property. 

 

This worked fine with a Sort(), Filter() in the items property but the moment I added the Search() part it looses its selection when refreshed no matter what convention is used to define the default item (I tried dozens of variations). It doesn't make a difference where the search function is nested, or if alone or in combination with other functions, as soon as it is introduced, it will not work.

 

Bottom line, this doesn't work as it is supposed to and its been like this for years. Almost every gallery requires a search function and having the selection randomly jump around is completely jarring and disorienting to the user and is not acceptable. Incredible that a developer is not given consistent and reliable way to control the selection in PowerApps...

PhilD
Kudo Kingpin
Kudo Kingpin

🙄

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,242)