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

Filtering a gallery by user

Hi frds,

 

I have created an app with the Sharepoint list.

The gallery displays the request of all the users. I need to filter like User can see only the requests created by him.

 

Please let me know how to filter the gallery.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Filtering a gallery by user

Hi @Naresh,

 

Could you please share a bit more about your app's configuration?

Further, could you please share more details about your SP list?

 

I have made a test on my side, please take a try with the following workaround:1.JPG

 

Set the Items property of the Gallery control to following formula:

Filter('20180709_case4',Author.Email=User().Email)

Note: The '20180709_case4' represents the SP list data source within my app.

 

On your side, you should type the following formula:

Filter('YourSPListName',Author.Email=User().Email)

 

 

In addition, you could also take a try with the following workaround:

  • Set OnVisible property of the first screen of your app to following formula:
UpdateContext({CurrentUser:User().Email})
  • Set Items property of the Gallery control to following formula:
Filter('20180709_case4',Author.Email=CurrentUser)

 

More details about the User function, please check the following article:

User function

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Appsessed
Level: Powered On

Re: Filtering a gallery by user

To acheive this, use a variable to get the users name either OnStart or OnVisible:

Set(ThisUser, User().FullName)

You will want this to match the SharePoint list - so if the request list stores the requestors name as an email, this must be User().Email, etc.

 

Set the Items of your gallery to:

Filter(SharePointList, RequestorColumnName.Text = ThisUser) 

Community Support Team
Community Support Team

Re: Filtering a gallery by user

Hi @Naresh,

 

Could you please share a bit more about your app's configuration?

Further, could you please share more details about your SP list?

 

I have made a test on my side, please take a try with the following workaround:1.JPG

 

Set the Items property of the Gallery control to following formula:

Filter('20180709_case4',Author.Email=User().Email)

Note: The '20180709_case4' represents the SP list data source within my app.

 

On your side, you should type the following formula:

Filter('YourSPListName',Author.Email=User().Email)

 

 

In addition, you could also take a try with the following workaround:

  • Set OnVisible property of the first screen of your app to following formula:
UpdateContext({CurrentUser:User().Email})
  • Set Items property of the Gallery control to following formula:
Filter('20180709_case4',Author.Email=CurrentUser)

 

More details about the User function, please check the following article:

User function

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Yla
Level: Powered On

Re: Filtering a gallery by user

Hello, I have similar requirement. I need to be able to filter the gallery base on the current user, the gallery is connected to the database that has the list of all the employees from two different branch office. Each branch office has an HR. So, if HR 1 is log in i want the gallery to show only the employees from Branch 1, same with HR 2 with only the list of employees showing from Branch 2. I've added an Office ID for each employee on the database. I also have a search box on top of the gallery. Right now, this the formula that i have, it works but it doesn't filter the gallery base on HR log in.

If(IsBlank(Search.Text),EmpCollection,SortByColumns(Search(EmpCollection,Search.Text,"LastName")"FirstName"))

 

Any tip would be great, Thank you!

Highlighted
llacefield
Level: Powered On

Re: Filtering a gallery by user

@v-xida-msft 

What would be a solution to delegation for that formula? Is it possible to only show the last 5, 10, or 15 items created for that user?

My concern is the list I am creating will supply list of requisitions for tools submitted by users, the list will become very large, very quickly. I don't want the app to  be slow because of it.

Any assistance would greatly be appreciated!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

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

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 41 members 4,106 guests
Please welcome our newest community members: