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

Filter by user in powerapp and sharepoint list

Hi there,

 

I have a list on a sharepoint teams site. I have created a powerapp to allow users to view the items in the list and to add new items to the list. I have a search bar with the following :

 

SortByColumns(Filter('My Table',TextSearchBox1.Text in Title),"Title",If(SortDescending1,Descending,Ascending))

 

This is currently working exactly how I need it to, however I want to add an extra filter that will allow users to see all items that were created by them. I have tried several things however they arent working or the search bar stops working.

 

I have a button that users can push and that would toggle the list to show either all items or items created by the user. This will be determined by a column with the name 'ItemCreator' and it is just a standard text box. I do have the default value set as:

 

User().FullName

 

On the button, I have the following under the 'OnSelect' section:

 

UpdateContext({FilterMyInteractions: !FilterMyInteractions})

 

Can I please have some help implementing this so that my search bar will still work?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Filter by user in powerapp and sharepoint list

@Amber_L 

Hi there!  I've got some code you can try.  Give it a shot and let me know.

 

My assumption is you only want to show the current user's records when FilterMyInteractions is True.

 

SortByColumns(
    Filter('My Table',
             TextSearchBox1.Text in Title,
If(FilterMyInteractions,ItemCreator=User().FullName,ItemCreator=ItemCreator) ), "Title", If(SortDescending1,Descending,Ascending) )

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Filter by user in powerapp and sharepoint list

@Amber_L 

Hi there!  I've got some code you can try.  Give it a shot and let me know.

 

My assumption is you only want to show the current user's records when FilterMyInteractions is True.

 

SortByColumns(
    Filter('My Table',
             TextSearchBox1.Text in Title,
If(FilterMyInteractions,ItemCreator=User().FullName,ItemCreator=ItemCreator) ), "Title", If(SortDescending1,Descending,Ascending) )

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

Highlighted
Helper I
Helper I

Re: Filter by user in powerapp and sharepoint list

That works perfect! I tried that code but I was just placing it in the wrong spot.

Thanks for your help!

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

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

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,913)