web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter SQL table on mu...
Power Apps
Answered

Filter SQL table on multiple optional fields

(0) ShareShare
ReportReport
Posted on by 9

Im trying to create a series of optional fields to filter my data source. 
I use check boxes to select the fields the user wish's to filter on.

MHackney_0-1599725890303.png

 

 

I am having trouble adding conditional filters however, I found a solution online which  doesn't work for me, it give's a delegation warning and fails to collect records.

 

ClearCollect(ArchiveSearch,Filter('[dbo].[Problems]',
If(ShowStatus.Value = false,true,FilterStatus.Selected.Result in Status) &&
If(ShowType.Value = false,true,FilterType.Selected.Type in Type) &&
If(ShowOwner.Value = false,true,FilterOwner.Selected.Result in Owner)))

 



Anyone have any suggestions how I can get this to work without having to write full filters for every possible combination of filter options which would be a couple of hundred lines long. 

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    Hi @MHackney ,

    The non-delegable item is the in filter - it looks like you simply want them to equal

    ClearCollect(
     ArchiveSearch,
     Filter('[dbo].[Problems]',
     If(
     ShowStatus.Value = false,
     true,
     Status=FilterStatus.Selected.Result
     ) &&
     If(
     ShowType.Value = false,
     true,
     Type=FilterType.Selected.Type
     ) &&
     If(
     ShowOwner.Value = false,
     true,
     Owner=FilterOwner.Selected.Result
     )
    )

    You are only ever going to get your Delegation limit anyway in the collection.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • MHackney Profile Picture
    9 on at

    Hmmm I had tried it with both equals and 'in'  with the same result, but direct copying your code seems to work correctly, Im not sure what was different but there must have been something slightly off.

    Thank you very much for the help. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 339 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 289

#3
Mohsin Ali Profile Picture

Mohsin Ali 228

Last 30 days Overall leaderboard