cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Partisan
Post Partisan

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
Highlighted
Post Partisan
Post Partisan

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

Highlighted
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
Highlighted
Post Partisan
Post Partisan

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

Highlighted
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

Highlighted
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."

Highlighted
Post Partisan
Post Partisan

Re: Filter Gallery with more than 1 condition

Thanks @mdevaney 

I like the logic in your suggestion

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

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

Top Solution Authors
Top Kudoed Authors
Users online (10,258)