cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Power Participant
Power Participant

Filter gallery based on current user and multiple values

Hi

 

Im trying to solve a filtering issue i have and at the same time ask if i'm doing it in a "best practites" way.

 

What i want to achieve is to filter a SharePoint gallery based on current user and the Column named "Status"

I want o to this by using buttons so when i press the button named "Open" it will list items in the gallery that have the status.value = open and is created by the current user.

 

My solution for the above is to set my Screen OnVisble to: ClearCollect(RecordsCollection, Filter(DataSource, Lower(Requester.Email) = Lower(User().Email)))

 

I then set my Gallery items to: RecordsCollection

Then  i create a button  named "Open" and set OnSelect to: ClearCollect(RecordsCollection, Filter(DataSource, Lower(Requester.Email) = Lower(User().Email) && Status.Value="Open"))

 

The above works but is it a good way of doing it? I do get delegation warning.

Now to my issue i want to add another value to the "Open" button, i want to display items from current user and Status.Value is Open or Assigned.

 

I cant seem to figure out how to get the filtering right when i add multiple values.

1 ACCEPTED SOLUTION

Accepted Solutions

@JimmyWork
You could show results with any status except Closed by putting the exclamation mark symbol or by using the does not equal sign.

!Status.value = "Closed"
Status.value <> "Closed"

However, per this post these statements might be subject to delegation on SharePoint. Is Status a Choice column in SharePoint? Maybe we can get around this issue if it is because Complex columns appear to be delegable when using does not equal <>.
https://powerapps.microsoft.com/en-us/blog/sharepoint-delegation-improvements/

View solution in original post

2 REPLIES 2
Power Participant
Power Participant

This seems to work.

ClearCollect(RecordsCollection, Filter(DataSource, Lower(Requester.Email) = Lower(User().Email) && Status.Value="Unassigned" || Lower(Requester.Email) = Lower(User().Email) && Status.Value="Assigned"))

 

Now i do wonder is this a good way of doing it? Or can i optimize this so i don't make unnecessary calls to fetch list and so on?

 

I also wonder is it possible to filter by doing show everything except if the Status.value = "Closed"

@JimmyWork
You could show results with any status except Closed by putting the exclamation mark symbol or by using the does not equal sign.

!Status.value = "Closed"
Status.value <> "Closed"

However, per this post these statements might be subject to delegation on SharePoint. Is Status a Choice column in SharePoint? Maybe we can get around this issue if it is because Complex columns appear to be delegable when using does not equal <>.
https://powerapps.microsoft.com/en-us/blog/sharepoint-delegation-improvements/

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (49,307)