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.

View solution in original post

5 REPLIES 5
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.

View solution in original post

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!

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!

DCI_18
Level: Powered On

Re: Filtering a gallery by user

Hello,

 

I tried the suggested formulas:

  • Set OnVisible property of the first screen of your app to following formula:
UpdateContext({CurrentUser:User().Email})

This is not work at all, I was not able to filter out other submissions and only view the user submissions.

 

  • Set Items property of the Gallery control to following formula:
Filter('20180709_case4',Author.Email=CurrentUser)

This is did work, however it created an issue alert. I attached the alert message, but it says it doesnt work on large data sets.

 

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
Users Online
Currently online: 146 members 4,894 guests
Please welcome our newest community members: