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

Re: Display Form Showing Wrong Selected Item. Visual Glitch?

Hi @Mr-Dang-MSFT

 

Trust you are well, The searchable text field has no conditions on it it will always be blank and the reset is equal to false for that property. this is to allow users to filter the gallery by the title of the item. 

 

As for the "In" function. I have a people multiselect field in SharePoint. Users add workers and clients to the two different fields, so I need to use the "In" function to allow it to "=" all the clients or all workers in that record and it would not be the same set of clients or workers for each record.  it is at max 10 selected users for each column. 

 

Just out of curiosity, The reason for setting the user() info Variable is that just a performance best practice or a functional best practice as I should be able to pull the User() info throughout the app when required.

 

@Mr-Dang-MSFT If it was an issue with one of the functions in the app. I would see it in the web designer when testing from there but the issue is only in the public live version of the app, Looking into the versions of power apps I see that the Public live version is PowerApps 3.18122.16 and the web designer is PowerApps 3.18122.23 could this not be the reason why it's working. I'm just spitballing here. 🙂 

 

I previously set the gallery filter to a variable and it has seemed to have fixed the issue. I have also changed display form to individual Label fields with lookups and it is working correctly too. one drawback is that you cannot have variables in variables so if you have a sort by variable you lose it. I just put a button to change the gallery variable to sort descending. 

 

hope this clears some of the questions up.

 

@RHernandez I added you just to see some of the workarounds I have used. 🙂

 

Many thanks 

 

PowerApps Staff Mr-Dang-MSFT
PowerApps Staff

Re: Display Form Showing Wrong Selected Item. Visual Glitch?

@SnowFlake can you go to File > App Settings > Advanced Settings and try turning off 'Improved app rendering' and see if it makes a difference? Note you will need to save and reopen the app to see the difference.

 

Re: User(). The function is volatile like Now() and Rand(), meaning that its value is subject to change. We know it likely won't change, but it works like that so it can be up to date. You have the flexibility to reference it directly or set it to a variable. As a best practice, if it's part of a calculation or condition, you should set it to a variable for performance as you don't want it changing for each case.

 

A few more details on my preferred method.

 

I set the selected record to a variable:

Set(selectedRecord,ThisItem)

Then I set the form's Item property one of two ways:

selectedRecord
LookUp(datasource,PrimaryKey=selectedRecord.PrimaryKey)

The first one is more static while the second can pull in the updated record (if someone else updated it) because it's a lookup. Here PrimaryKey is whatever the name of the column is that you use for identifying unique record.

RHernandez
Level: Powered On

Re: Display Form Showing Wrong Selected Item. Visual Glitch?

@Mr-Dang-MSFT

My filter statement for the gallery is pretty straightforward....

 

Filter(NewEmployeeOnboarding, SupervisorName = User().FullName)

 

I tried turning off the 'Improved app rendering' because that has fixed some issues in the past, but it did not help in this case.  

Highlighted
RHernandez
Level: Powered On

Re: Display Form Showing Wrong Selected Item. Visual Glitch?

@Mr-Dang-MSFT

The following worked for me...

 

I set the selected record to a variable:

Set(selectedRecord,ThisItem)

Then I set the form's Item property one of two ways:

LookUp(datasource,PrimaryKey=selectedRecord.PrimaryKey)

That being said, I do not think this is an acceptable work around.  Why does the Gallery.Selected logic work in the designer, but not out of the designer?  This is definitely a bug that needs to be worked out by the PowerApps team. Like @SnowFlake said, the versions between the designer and live do not match up, so there is definitely something wrong between the 2 versions.

 

 

View solution in original post

PowerApps Staff Mr-Dang-MSFT
PowerApps Staff

Re: Display Form Showing Wrong Selected Item. Visual Glitch?

@RHernandez, it's possible there is a bug, but from the look of your filter formulas which contain parts that can be improved (see my past posts), it's very likely the two of you have something that is reloading the gallery. And in reloading, its selection reverts to the top. I would check each control that the gallery is filtered on and even simplify your filter.

 

I would not consider what I shared a work-around. It's a good practice. Gallery.Selected is useful when you know the gallery is not subject to change. But if you bind a gallery directly to the datasource or a filter on it, it is subject to change as it receives new content or updates (by refresh or patch); this is by design. 

 

So by storing your selection in a variable, and referencing the variable, you can keep the gallery bound directly to the datasource so it gets new content, but you also ensure that what you're referencing is not a moving target.

SnowFlake
Level: Powered On

Re: Display Form Showing Wrong Selected Item. Visual Glitch?

Hi @Mr-Dang-MSFT

 

Thank you for all your help. I see what you saying about not using gallery.selected with moving parts and will not do it going forward, rather use a variable. I also agree with @RHernandez as the app should break in the designer if any functions were wrong. This not being the case in two separate scenarios, which is weird. 

 

I will accept @RHernandez solution as it has everything needed to get past this issue if people are making apps the way we did with the gallery.selected. and encounter the issue. 

 

@Mr-Dang-MSFT I found your youtube channel and found it very informative with tips and tricks, good job and keep it up. 🙂 

 

Thank you all again for all the assistance with the above.

 

 

Ubertortle
Level: Powered On

Re: Display Form Showing Wrong Selected Item. Visual Glitch?


@Mr-Dang-MSFT wrote:

@SnowFlake can you go to File > App Settings > Advanced Settings and try turning off 'Improved app rendering' and see if it makes a difference? Note you will need to save and reopen the app to see the difference.

 

 


This Fixed the issue for me. Thank you

ErikM9
Level: Powered On

Re: Display Form Showing Wrong Selected Item. Visual Glitch?

Hello,

I'm getting comfortable with PowerApps. 

I found myself in a similar situation where I have the entire recordset (pulled from a Sharepoint list) displayed and I have filtered screened. 

When I click the "NextArrow" for record details, I'm presented with the correct information. However, when I do the same thing from the filter screen, the details don't match the source record.

 

I suspect the solution is as per the posting by @Mr-Dang-MSFT, but I don't know where to make the entries:

I set the selected record to a variable:

Set(selectedRecord,ThisItem)

Then I set the form's Item property one of two ways:

selectedRecord
LookUp(datasource,PrimaryKey=selectedRecord.PrimaryKey)

Thank you,

Erik 

BARD
Level: Powered On

Re: Display Form Showing Wrong Selected Item. Visual Glitch?

I'm in the same boat as @ErikM9 in that I think this might be my solution but am uncertain how to apply it. Any help would be appreciated. Thanks

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,447)