cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kudo Kingpin
Kudo Kingpin

Filtering on multiple fields

Hi ,

I have a gallery and i'm trying to give users several ways to filter it. I have controls above the gallery to let the user select a Year, region, customer or keyword to filter on. I want to use only the filters the user has selected. 

 

My script ends up looking like this (this represents just the conditions, not the actual filters):

conditions.PNG

 

After adding the actual filtering logic for each condition (and god forbid an other condition) this ends up being hundreds of lines of script that are largely incomprehensible, even to the author!

 

Is there a better way to do this?

 

What we really need is a real code editor! If i could edit this script in an intelligent VSCode editor I'd have this done in minutes. The way it is it's taking days!

 

Please give me back my curly braces!

24 REPLIES 24

@IvanZ 

Then do you believe this code would work?  I ask only because I need a 2nd set of eyes on this to make sure there is no delegation error.

 

Filter(
    FPARequests,
    IsBlank(tbYear.Text)=true Or Year = tbYear.Text,
    IsEmpty(cbxRegion.Selected)=true Or Region = cbxRegion.Selected,
    IsBlank(tbCustomer.Text)=true Or Customer tbCustomer.Text,
    IsBlank(tbKeyword.Text)=true Or Keyword = tbKeyword.Text
)

 

I am no expert, but by looking at the formula it is fine. Plus Powerapps also didn't throw in delegation error, and I assume your gallery returns more than 1 result. So you have 3 set of eyes for this formula. 

 

Good luck.

@IvanZ 

Thanks for working on this with me and helping to improve my knowledge of delegation.

Thaniks mdevaney ,

That works! 

 

@RussellGove 

I am happy to help!  Glad to see it is working for you.

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

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