cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Filter based upon Person/Group field matching Current User

I have a PowerApp with a SharePoint list as datasource.  I want to do the following:

 

Filter the list display in Gallery based on the following test:  Show the list of records for which the current user is listed as the product manager.  The Product Manager field is populated from a Person/Group field in the SP List.  I'm having a hard time doing this, as it seems to be a mismatch of field types.  It actually works if I search on email for current user and = it to email of Product Manager, but it doesn't actually filter anything.  

 

Thanks!

Carole 

3 REPLIES 3
Super User III
Super User III

Hi @CaroleKV ,

 

Try this:

Filter(SPListName, User().Email in Productmanager.email) // This works only for single people picker selection
Filter(SPListName, User().Email in Concat(Productmanager,Email&",") // This works only for single people picker selection


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more. 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
Community Support
Community Support

Hi@CaroleKV,

Based on the issue that you mentioned, do you want to filter the gallery based on the user?

Combine that with your description, you want to check if the current user exists in the Product Manager column, if it does, filter the gallery based on the Person/Group column.

Thanks for @KrishnaV posting a solution. I will make some addition to this issue. As an alternative solution, you can try the formula below.

  • Set the OnVisible property of the screen as below

 

Set(CurrentUser,User().Email)​

 

  • Set the Items property of the gallery and call the variable.

 

Filter(DataSource,PersonColumn.Email = CurrentUser)​

 

Note: If this can not solve your issue, please post some screenshots about the error message.

 

Best Regards,

Qi

The problem I couldn't get around was that the User record type is not the same as the Person record type at all.  And the person type turns the name into LastName,First instead of First Name Last Name, so it was never matching.  I got around this by using the Office365User data connection, and converting the name into LastName, First so it would find a match.  That solved the problem.  My other problem was that this code is amongst a whole bunch of other Filter and Search code on that same gallery, so it was hard to even figure out where to put it, much less what it should be.  

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (90,263)