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

Filter Gallery with more than 1 condition

Hi

I have a canvas app data source is SPO, on the gallery I'd like to filter the items so the created by user can view their own items but the approvers can view all the items, the first part of the fx is fine, the second is not:

 

Filter(ListName,'Created By'.Email=VarUser || 'Created By'.Email=VarApprover)

This obviously will not work, as VarApprover is not the creator of the item... but in unsure on the syntax to use

 

VarApprover is set at OnStart and the info is picked up from another SPO list where I am adding in the names and email of the approvers:

Set(VarUser, User().Email);
Set(VarApprover, LookUp(AnotherListName, Email = VarUser,Email))

 

Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions
G99
Level: Powered On

Re: Filter Gallery with more than 1 condition

I think I have it:

 

Filter(ListName,'Created By'.Email=VarUser || VarUser= VarApprover)

 

Unless someone thinks this is the wrong way?

View solution in original post

Super User
Super User

Re: Filter Gallery with more than 1 condition

@G99 

I would change the code in OnStart to make VarApprover a true/false type variable:  true when the approver is using the app and false when they are not.

Set(VarApprover, LookUp(AnotherListName, Email = VarUser,Email) = User().Email)

 

Then you can change the code in your gallery's Items property to look like this.  When VarApprover is true it will show all records.  Notice how I'm not making any comparison here and simply checking for true/false of VarApprover.

Filter(ListName,'Created By'.Email = VarUser Or VarApprover)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

4 REPLIES 4
G99
Level: Powered On

Re: Filter Gallery with more than 1 condition

I think I have it:

 

Filter(ListName,'Created By'.Email=VarUser || VarUser= VarApprover)

 

Unless someone thinks this is the wrong way?

View solution in original post

Super User
Super User

Re: Filter Gallery with more than 1 condition

@G99 

I would change the code in OnStart to make VarApprover a true/false type variable:  true when the approver is using the app and false when they are not.

Set(VarApprover, LookUp(AnotherListName, Email = VarUser,Email) = User().Email)

 

Then you can change the code in your gallery's Items property to look like this.  When VarApprover is true it will show all records.  Notice how I'm not making any comparison here and simply checking for true/false of VarApprover.

Filter(ListName,'Created By'.Email = VarUser Or VarApprover)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Super User
Super User

Re: Filter Gallery with more than 1 condition

@G99 

Both of our methods would work.  You can accept them both as the solution in my opinion.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

G99
Level: Powered On

Re: Filter Gallery with more than 1 condition

Thanks @mdevaney 

I like the logic in your suggestion

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,114)