cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shaneOZ
Level 8

Re: Gallery item edit brings up WRONG item!

I had the same issue, change the onselect of the gallery to this.

 

Navigate(DetailScreen1,Fade,{conRecord: ThisItem})        this is your screen name

 

and change the item property of the screen you wish to view from BrowseGallery1 to conRecord

 

Super User
Super User

Re: Gallery item edit brings up WRONG item!


@Mr-Dang-MSFT wrote:

Hi @martinav,

It looks like you've sorted this out with Set().

 

I've answered a similar question on this topic before:

https://powerusers.microsoft.com/t5/General-Discussion/Display-Form-Showing-Wrong-Selected-Item-Visu...

 

As @RandyHayes mentioned, Gallery.Selected is a moving target. If you want other controls to respond to Gallery.Selected as it changes, point them to Gallery.Selected. For instance, suppose you have two galleries on a screen: one gallery is used to filter another gallery. The filtered gallery would point to the first gallery using Gallery.Selected.

@Mr-Dang-MSFT ,

 

I completely  understand the "moving target" issue.  However, this is not my issue.  Items in my apps are only authorized to be edited by a single individual by virtue of my using an assigned user, and a filter that will only show him items that are assigned to him only.  Thus, there will never be two people updating the same item.

 

My issue is that it is purely broken.  It is not the intention of Gallery.selected to erroneously switch to a different item, nor to randomly switch values to the first item in the gallery.  In fact, my Apps have been working great for months, and this started happening mid-january.  Thus, using a Set() for the gallery item is a work-around to fix what is broken in PowerApps.  That is what is not acceptable.  I cant keep changing multiple apps as things change or break in PowerApps.  Using Gallery.selected for the Item control is also the default when you create a new app from one of the very basic list templates.  

 

Yes, my particular issue was fixed using set(), but the use of Gallery.Selected should have not been an issue whatsoever.  It is not working as designed, and needs fixed!   If it is working as designed, I fail to see any practical application for having data change randomly to another item.

Super User
Super User

Re: Gallery item edit brings up WRONG item!

@shaneOZ ,

 

Yes, that looks to be a similar work-around as my use of set(), with the exception of your method is using a context variable instead of a global variable.  Same results.  But, its also a work-around to the underlying problem that Gallery.selected has been broken since mid-January.

 

 

PowerApps Staff tahoon
PowerApps Staff

Re: Gallery item edit brings up WRONG item!

Ok, I have managed to reproduce this issue. I can confirm that it happens with particular conditions

  • Only happens with SharePoint data source. Other data sources like SQL, OneDrive, are fine.
  • Only happens if the data has some filters on it. For example, Gallery.Items = Filter(SP_data, ....)
  • Only when viewing the app, not when editing the app.
  • Only happens the first time like @martinav mentioned. Subsequent navigations all work correctly.
  • Error started sometime in mid-January

The specific steps to demonstrate this bug:

  1. Create a new blank app
  2. Insert a sample Gallery
  3. Connect to a Sharepoint list
  4. Set Gallery.Items = Filter(SP_list, some_conditions). Make sure the filtered list contains more than one item.
  5. Insert new screen
  6. Set the arrow icon in the gallery to navigate to the new screen: Icon.OnSelect = Navigate(Screen2, ...)
  7. On the new screen, insert a Label. Set that Label text to Gallery.Selected.<some identifying field>
  8. Publish app and view it
  9. Click the arrow icon of the last item in gallery
  10. Navigates to the second screen. The Label should show that the last item is selected, but actually the first item is selected.

A fix is being prepared. One workaround is already mentioned in this thread, which is to use a context or global variable to store the selected item. I understand the frustration and will keep this thread posted when the fix is released.

Super User
Super User

Re: Gallery item edit brings up WRONG item!

@tahoon ,

 

Great to hear this issue has been taken seriously.  Thank you.

 

I will also state that I also experienced other random ocurrences of the data switch which was not on the first time condition as explained above.  I also had a single field that would continually change (pulldown).  That was only resolved using the set() technique.  I also had another field that was text entry, but it was unlocked.  I had to delete the  datacard and recrete it, then it worked correctly.  

 

Regardless, great job re-creating the issue.  That is often the hardest part.

PowerApps Staff tahoon
PowerApps Staff

Re: Gallery item edit brings up WRONG item!

The fix has been deployed a few weeks ago. Let me know if this issue still persists.

marketingandel
Level: Powered On

Re: Gallery item edit brings up WRONG item!

Its still there for me. First time I select an item from a gallery it selects the item and then goes back to default (1st record from my SP List) no mather what I do . I tested with a Text label to see the default record that is coming from the sp list first time I log with a new session and of course it shows the first item in my filtered/sorted gallery.

The moment I select an new item it changes the text label (Gallery.Selected.Title) to the one I selected and then before sending me to the screen im supose to navigate it changes back to the first item in the filtered gallery. I go back , try again and it selects the right item every time. It is annoying that every first time you log in you need to select a random item insteam of the one you need. It doesnt matter anyway as you have to do the "routine", select a random item,go back , select the "real" item.

Super User
Super User

Re: Gallery item edit brings up WRONG item!

Extra post... first time gave error, but apparently posted anyway... deleted content to reduce redundancy.

 

Highlighted
Super User
Super User

Re: Gallery item edit brings up WRONG item!

@marketingandel , @tahoon ,

 

The specific issue that had me post in this thread have been "fixed" with the workaround using a set() statement to create an array variable with the sharepoint record, and then using the array variable in ALL controls in the gallery.  I wont be changing those back to see if the issue remains.  Its one of those "if its not broke, dont fix it" issue.  I have plenty of other problems that keep me overly busy.

 

I will mention that I had used a gallery selection to drive an information page.  The behavior of that page changed yesterday that required me to revamp that entire page into a Set() scenario.  So, there are still issues.  It seems they are related to the behaviors mentioned in this thread, but it seems the problems in PA can be numerous, and thus may be unrelated.  I just dont know any more!

 

Now, I have issues posting my reply.  Either there is a "negative filter", or this forum is driven by PA galleries?

 

image.png

 

Another interesting point.  I now always do a <CNTRL_A><CNTRL_C> before picking post now due to this random phenomenon so I dont lose my typing efforts.

shaneOZ
Level 8

Re: Gallery item edit brings up WRONG item!

maybe use the onvisi


@marketingandel wrote:

Its still there for me. First time I select an item from a gallery it selects the item and then goes back to default (1st record from my SP List) no mather what I do . I tested with a Text label to see the default record that is coming from the sp list first time I log with a new session and of course it shows the first item in my filtered/sorted gallery.

The moment I select an new item it changes the text label (Gallery.Selected.Title) to the one I selected and then before sending me to the screen im supose to navigate it changes back to the first item in the filtered gallery. I go back , try again and it selects the right item every time. It is annoying that every first time you log in you need to select a random item insteam of the one you need. It doesnt matter anyway as you have to do the "routine", select a random item,go back , select the "real" item.


Maybe try the using the screens's with the gallery in it to onvisible property to Refresh(YOURSHAREPOINTLIST) 

 

dont know the setting the items to variable works for me?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,422)