cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
toysibuy
Level: Powered On

Form not loading correct selecteditem from Gallery

Form not loading correct selecteditem from Gallery


This one has me stumped... Here's my set up:

Page with a Gallery
Item gets selected
Navigate to another page with a form
the form item actually filters a second Sharepoint List to look up another item which is realted to the item selected in the gallery
Here's the issue... the first time I select an item from the gallery, no matter which item is selected, the form shows the first item in the gallery. If I go back to the gallery page again, and try selecting the other item again, then the form will load the appropriate item. Ex:

 

Gallery:

Item 1
Item 2
Item 3
Item 4
User selects Item 4

OnSelect = Select(Parent); Navigate('Feedback Screen',ScreenTransition.None)


Feedback form shows, but the data in the form matches Item 1 not Item 4. This only happens the first time through, if you go back to the gallery, and select Item 4 again, the feedback form will show Item 4 data. This happens no matter which item is selected and only the first time through. The Form item property is set to:

 

Item = First(Filter('second Data Source',parentID = 'Gallery 1'.Selected.ID))

I've tried storing the Selected.ID in a variable (using Select(Parent); Navigate('Feedback Form',ScreenTransition.None,{mySelectedItem:ThisItem.ID})) and having the Form.Item property read from the mySelectedItem variable instead of the gallery directly. To get visibility to what was going on, I set a label on the feedback screen to show the contents of 'Gallery 1'.Selected.ID and my variable. It show the varible was set correctly, but the 'Gallery 1'.Selected.ID still points to the first item (even though it wasn't selected).


I've tried using RefreshFrom both before and after the navigate step. I refresh all data source onStart of App to ensure nothing is cahced.

 

I'm running out of ideas on how I can force it to use the truly selected item and not the first item for the first time through.

1 ACCEPTED SOLUTION

Accepted Solutions
toysibuy
Level: Powered On

Re: Form not loading correct selecteditem from Gallery

Thanks everyone for the suggestions!

 

So I did manage to get this to work... it turns out the approach of setting it in a variable did work after all.  The form was pulling the correct data using this method.  I also had some header information above the form, that I forgot to update... so it wasn't using the variable and was still set to gallery.selected.id, this made it appear to be wrong.  Once I set those label to also reference the variable and not the gallery directly, everything is now in sync.

So this was a nice workaround, but it just make me nervous that referencing the gallery directly did not seem to work.  I have several othe powerapps and they all reference the galleries.  I wonder if they are working or if just none of my users have noticed the issue.

5 REPLIES 5
cwebb365
Level 10

Re: Form not loading correct selecteditem from Gallery

 

Try using lookup instead of Filter on the item. 

 

Item = Lookup('second data source',parentID = Gallery1.Selected.ID).ID

KroonOfficeSol
Level 10

Re: Form not loading correct selecteditem from Gallery

@toysibuy

 

This is strange, but good come from the fact that the selected items is not instantly set where thisitem.id is. Probably when you wait some time the gallery will update. So basically you have a bad performance issue I think.

 

What you could do is to delete the navigation part for now and add a label (on .Text do the gallery1.selected.ID), see what the label does when clicking item 4. How long does it takes to update?

 

Just to see what happens, because you should use the variable in the form.item like

First(Filter('second Data Source',parentID = MySelectedItem))

This makes you can use the screen from differt screen off your app if you want to and you can clear the MySelectedItem and do Reset(Form) before leaving the second screen. Then there wont be echo's in your form from an earlier selection.

 

Hope this helps,

 

Paul

 

toysibuy
Level: Powered On

Re: Form not loading correct selecteditem from Gallery

Thanks everyone for the suggestions!

 

So I did manage to get this to work... it turns out the approach of setting it in a variable did work after all.  The form was pulling the correct data using this method.  I also had some header information above the form, that I forgot to update... so it wasn't using the variable and was still set to gallery.selected.id, this made it appear to be wrong.  Once I set those label to also reference the variable and not the gallery directly, everything is now in sync.

So this was a nice workaround, but it just make me nervous that referencing the gallery directly did not seem to work.  I have several othe powerapps and they all reference the galleries.  I wonder if they are working or if just none of my users have noticed the issue.

Highlighted
Sarang24Dev
Level: Powered On

Re: Form not loading correct selecteditem from Gallery

The approach of using a variable doesn't work for me. It still shows the wrong item in the form.
Ubertortle
Level: Powered On

Re: Form not loading correct selecteditem from Gallery

It appears this is still an issue. It was doing this to me before and I had thought I fixed it by refreshing data source before navigation but the issue has returned.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 507 members 6,148 guests
Recent signins:
Please welcome our newest community members: