cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Filter gallery to only show record for current user - SP list

Hi, I have been on numerous forums & watched a number of videos but still struggling! I have an app which is linked to a SharePoint list with over 1400 employees. I have developed the app based on the 'out of the box' phone layout template that comes already set up with various functions & pages.
My query is how do I filter the gallery to only show the record for the current user? I am aware there could b delegation issues due to the size of the SP list.
The code which was already populated in BrowseGallery1 – Items = SortByColumns(Filter([@'OE Asset Register - Staff Data'], StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))
Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Filter gallery to only show record for current user - SP list

Hi @Flockters 

 

To configure this, you can follow:
 
1) Set a variable to get the current user details:
App -> OnStart -> Set(MyDetails, User())
 
Note: If you are in edit mode, select the three dots on the left menu and select "Run OnStart". This will populate the value for current session and this variable will automatically set when the app is played or refreshed.
 
2) Update the expression on the gallery control Items to:
SortByColumns(Filter([@'OE Asset Register - Staff Data'],ColumntoSearch = MyDetails.FullName && StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))
 
Here I assumed that you have a single line of text column which stores the name of the users. 
 
If this a person type column:
SortByColumns(Filter([@'OE Asset Register - Staff Data'],ColumntoSearch.DisplayName = MyDetails.FullName && StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Highlighted
Dual Super User III
Dual Super User III

Re: Filter gallery to only show record for current user - SP list

Hi @Flockters 

 

To configure this, you can follow:
 
1) Set a variable to get the current user details:
App -> OnStart -> Set(MyDetails, User())
 
Note: If you are in edit mode, select the three dots on the left menu and select "Run OnStart". This will populate the value for current session and this variable will automatically set when the app is played or refreshed.
 
2) Update the expression on the gallery control Items to:
SortByColumns(Filter([@'OE Asset Register - Staff Data'],ColumntoSearch = MyDetails.FullName && StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))
 
Here I assumed that you have a single line of text column which stores the name of the users. 
 
If this a person type column:
SortByColumns(Filter([@'OE Asset Register - Staff Data'],ColumntoSearch.DisplayName = MyDetails.FullName && StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Power Participant
Power Participant

Re: Filter gallery to only show record for current user - SP list

@Flockters 

Consider leveraging User() to help you here. This is an out of the box PowerApps function that returns useful contextual information about the current user that is using the app. If any of the below is in common with one your columns, you can try and filter by this information and it is a handy way to use the current user's contextual info - including even to possibly filter your SharePoint List by this information.

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-user

 

Returns information about the current user.

Description

The User function returns a record of information about the current user:

Property Description
User().EmailEmail address of the current user.
User().FullNameFull name of the current user, including first and last names.
User().ImageImage of the current user. This will be an image URL of the form "blob:identifier". Set the Image property of the Image control to this value to display the image in the app.

 

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,984)