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

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
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
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

Amber_L
Level: Powered On

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
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,887)