Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 1GbzsnWdHg/ZNA6lzNrpBQ
Power Apps - Building Power Apps
Unanswered

Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

Like (0) ShareShare
ReportReport
Posted on 26 Apr 2023 12:27:19 by 174

Hello experts,

I am trying to filter my gallery with four dropdowns, two combo boxes, two date pickers (for selecting a range of dates) & a textinput for contains search. My data source is SQL server and I am using created views for showing data and I have more than three hundred thousand records in it. Below is the formula that I am using but its not working. Also, the formula for my three dropdowns is as follows 

Daypart_Dropdown_1 - (Items): ForAll(Split(("All," & Concat( ForAll(Distinct(vw_Job_List,DayPart ), {Result: ThisRecord.Value}),                  Result&",")), ","), {Result: ThisRecord.Value})

Season_Dropdown_1 - (Items): ForAll(Split(("All," & Concat( ForAll(Distinct(vw_Job_List,Season ), {Result: ThisRecord.Value}), Result&",")), ","), {Result: ThisRecord.Value})

Brand_Dropdown_1 - ForAll(Split(("All," & Concat( ForAll(Distinct(vw_Job_List,Brand ), {Result: ThisRecord.Value}), Result&",")), ","), {Result: ThisRecord.Value})

Category_Dropdown_1 - ForAll(Split(("All," & Concat( ForAll(Distinct(vw_Job_List,Category ), {Result: ThisRecord.Value}), Result&",")), ","), {Result: ThisRecord.Value})

Photogrpaher_Combo_1 - (combobox) items - Another view was created just to get the names of the photographers in it.

and same goes for talent combo box.

the code for gallery is below 

Search(Filter(vw_Job_List,(Daypart_Dropdown_1.Selected.Result="All"||DayPart=Daypart_Dropdown_1.Selected.Result)&&(Season_Dropdown_1.Selected.Result="All"||Season=Season_Dropdown_1.Selected.Result)&&(Brand_Dropdown_1.Selected.Result="All"||Brand=Brand_Dropdown_1.Selected.Result)&&(Category_Dropdown_1.Selected.Result="All"||Category=Category_Dropdown_1.Selected.Result)&&(JobPhotographer=Photogrpaher_Combo_1.Selected.FullName)&&(TalentName=Talent_Combo_box_1.Selected.'Full Name')&& DateValue(ShootDate,"EN-us")>=DatePicker1_3.SelectedDate,DateValue(ShootDate,"EN-us")<=DatePicker1_4.SelectedDate),TextInput7_1.Text,"EpisodeTitle","JobPhotographer")

But its not showing any results please do help me in fixing this code and how to avoid delegation warning so that it could work along all the records. Also I have added a screenshot for your reference

@BCBuizer @Drrickryp @CNT @TheRobRush @Rusk  Hope you guys will help me out with this issue 

pw7.PNG

Categories:
  • coreypac Profile Picture
    13 on 27 Apr 2023 at 14:21:28
    Re: Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

    Try my Filter code in your Gallery Items property by first only defining your search TextBox and the Column it will be searching on.  Do this one by one adding in your combo boxes with additional and statements: ''&&".  I always start as simple as I can get that working then slowly add complexity. 

     

    Using the Find function with the Filter Function returns the starting position so including the "<=1" at the end enables this method to function with multiple search items.   You can reference The Filter and Find functions here: https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-filter-lookup

    and here: https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-find

     

    If you want to use a combo instead of a Textbox just add another line to the filter formula I referenced before. 

    like this :

     (Find(ComboBox.Selected.Value, ColumnName) >=1)

     

  • muzamil-baxture Profile Picture
    174 on 27 Apr 2023 at 13:05:55
    Re: Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

    Hey @coreypac , Thanks for replying, But I didn't understand what you share please could you elaborate  more ?

    Thanks

  • coreypac Profile Picture
    13 on 27 Apr 2023 at 12:23:40
    Re: Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

    I built my screen with multiple Text boxes one per column to give the user the ability to filter the gallery by typing in each textbox.  You may be able to adapt my code to meet your needs:

     

    //This Code Goes into Gallery Items: 
    
     Filter(
    
     CollectionName,
    
     (Find(Lower(txtboxFilter1.Text), Lower(ColumnName1)) >=1) &&
    
     (Find(Lower(txtboxFilter2.Text), Lower(ColumnName2)) >=1)
    
     )
  • WarrenBelz Profile Picture
    146,771 Most Valuable Professional on 27 Apr 2023 at 07:07:50
    Re: Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

    Hi @muzamil-baxture ,

    Then you have a Delegation issue as the DateValue() function is not Delegable, however @BCBuizer has a good point that you may be able to leverage - it will be a bit more complex than this splitting out the text elements. I am not an SQL user either and am quite surprised that Dates have this issue, even if not in Text form.

    WarrenBelz_0-1682579186981.png

     

  • muzamil-baxture Profile Picture
    174 on 27 Apr 2023 at 06:42:00
    Re: Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

    @WarrenBelz , Thanks for replying I really appreciate your response. The date values are stored in form of text that's why I had to use the 'DateValue()'  function, and this is giving me delegation warning. Is there a workaround for this as I have a very large dataset in SQL server ?

  • WarrenBelz Profile Picture
    146,771 Most Valuable Professional on 26 Apr 2023 at 21:03:09
    Re: Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

    Hi @muzamil-baxture ,
    Responding to the PM you sent - if your date values are stored as Dates, you should not need DateValue()

    Search(
     Filter(
     vw_Job_List,
     (
     Daypart_Dropdown_1.Selected.Result = "All" || 
     DayPart = Daypart_Dropdown_1.Selected.Result
     ) &&
     (
     Season_Dropdown_1.Selected.Result = "All" || 
     Season = Season_Dropdown_1.Selected.Result
     ) && 
     (
     Brand_Dropdown_1.Selected.Result = "All" || 
     Brand = Brand_Dropdown_1.Selected.Result
     ) &&
     (
     Category_Dropdown_1.Selected.Result = "All" || 
     Category = Category_Dropdown_1.Selected.Result
     ) && 
     JobPhotographer = Photogrpaher_Combo_1.Selected.FullName && 
     TalentName = Talent_Combo_box_1.Selected.'Full Name' && 
     ShootDate >= DatePicker1_3.SelectedDate,
     ShootDate <= DatePicker1_4.SelectedDate
     ),
     TextInput7_1.Text, 
     "EpisodeTitle",
     "JobPhotographer"
    )

     

     

  • BCBuizer Profile Picture
    22,048 Super User 2025 Season 1 on 26 Apr 2023 at 20:14:47
    Re: Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

    Hi @muzamil-baxture ,

     

    No expert on using SQL as a datasource here.

     

    However, according to the documentation a workaround is to use calculated columns: SQL Server - Connectors | Microsoft Learn

  • muzamil-baxture Profile Picture
    174 on 26 Apr 2023 at 19:59:50
    Re: Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

    @BCBuizer  thanks for replying, My database is SQL server so Search function is delegable I don't have delegation warning for that, also its my requirement to have 'contains search' and as we know that can only be implemented by using search function. I have delegation warning at the date picker control, I think date functions are not delegable in it. So what could be the possible workaround for it ? as I have to deal with more than  three hundred thousand records. Also its the requirement of the project to have that much data in it.

  • BCBuizer Profile Picture
    22,048 Super User 2025 Season 1 on 26 Apr 2023 at 19:21:01
    Re: Filtering gallery with multiple dropdowns, comboboxes, search input & date picker controls.

    Hi @muzamil-baxture ,

     

    As a first step, the Search function needs to be removed and replaced with StartsWith:

     

     

    Filter(
    	vw_Job_List,
    	Daypart_Dropdown_1.Selected.Result="All"||DayPart=Daypart_Dropdown_1.Selected.Result,
    	Season_Dropdown_1.Selected.Result="All"||Season=Season_Dropdown_1.Selected.Result,
    	Brand_Dropdown_1.Selected.Result="All"||Brand=Brand_Dropdown_1.Selected.Result,
    	Category_Dropdown_1.Selected.Result="All"||Category=Category_Dropdown_1.Selected.Result,
    	JobPhotographer=Photogrpaher_Combo_1.Selected.FullName,
    	TalentName=Talent_Combo_box_1.Selected.'Full Name', 
    	DateValue(ShootDate,"EN-us")>=DatePicker1_3.SelectedDate,
    	DateValue(ShootDate,"EN-us")<=DatePicker1_4.SelectedDate,
    	StartsWith("EpisodeTitle", TextInput7_1.Text) || StartsWith("JobPhotographer",TextInput7_1.Text)
    )

     

     

    If there are still delegation warnings, please share a screenshot with the blue squiggly lines to indicate which of the conditions are causing the issue.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,771 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard