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

Combo Box filtering Gallery when toggle is true

I've got a gallery that shows results from a a datasource, I've got a toggle on the page that when clicked it filters the data to a certain paramater.

 

However, I also have a combo box the further filters the data when items are selected from it. What I would like to achieve is that when the toggle is selected the combo box filters also are applied when clicked. The code that I currently have is below, I believe this is possible, but simply can not figure out how.

 

Anyone have any ideas? 

If(
    Toggle1.Value = true,
    Filter(
        DAB, <= Data Source
        Current_Category = "D" && Fiscal = "FY19/20" <= Column/Field
    ),
    If(
        IsEmpty(ComboBox4.SelectedItems.'Level 1 Function'),
        Filter(
            DAB,
            Fiscal = "FY19/20"
        ),
        Filter(
            DAB,
            'Level 1 Function (AP19/20)' in ComboBox4.SelectedItems.'Level 1 Function'
        )
    )
)

  

1 ACCEPTED SOLUTION

Accepted Solutions
QJappie22
Level 8

Re: Combo Box filtering Gallery when toggle is true

Hi @southafrican,

Try changing your code in:

If(
    Toggle1.Value,
    Filter(
        DAB,
        Current_Category = "D" && Fiscal = "FY19/20",
        If(
            IsEmpty(ComboBox4.SelectedItems.'Level 1 Function'),
            Fiscal = "FY19/20",
            'Level 1 Function (AP19/20)' in ComboBox4.SelectedItems.'Level 1 Function'
        )
    ),
    If(
        IsEmpty(ComboBox4.SelectedItems.'Level 1 Function'),
        Filter(
            DAB,
            Fiscal = "FY19/20"
        ),
        Filter(
            DAB,
            'Level 1 Function (AP19/20)' in ComboBox4.SelectedItems.'Level 1 Function'
        )
    )
)

Hope this solves your problem! 🙂

View solution in original post

6 REPLIES 6
Dual Super User
Dual Super User

Re: Combo Box filtering Gallery when toggle is true

Hi @southafrican 

 

what part of the formula is not working?

southafrican
Level: Powered On

Re: Combo Box filtering Gallery when toggle is true

Basically, when I click the toggle the selected items in the combo box is no longer filtering the gallery.

Dual Super User
Dual Super User

Re: Combo Box filtering Gallery when toggle is true

Hi @southafrican 

 

 

for the gallery if you just use the following -

 

  Filter(
            DAB,
            'Level 1 Function (AP19/20)' in ComboBox4.SelectedItems.'Level 1 Function'
        )

 

does it filter?

 

 

QJappie22
Level 8

Re: Combo Box filtering Gallery when toggle is true

Hi @southafrican,

Try changing your code in:

If(
    Toggle1.Value,
    Filter(
        DAB,
        Current_Category = "D" && Fiscal = "FY19/20",
        If(
            IsEmpty(ComboBox4.SelectedItems.'Level 1 Function'),
            Fiscal = "FY19/20",
            'Level 1 Function (AP19/20)' in ComboBox4.SelectedItems.'Level 1 Function'
        )
    ),
    If(
        IsEmpty(ComboBox4.SelectedItems.'Level 1 Function'),
        Filter(
            DAB,
            Fiscal = "FY19/20"
        ),
        Filter(
            DAB,
            'Level 1 Function (AP19/20)' in ComboBox4.SelectedItems.'Level 1 Function'
        )
    )
)

Hope this solves your problem! 🙂

View solution in original post

Highlighted
QJappie22
Level 8

Re: Combo Box filtering Gallery when toggle is true

Hi @southafrican,

I tested the code in my previous post again and found out that it still didn't do the trick... This one should be better:

 

If(
    Toggle1.Value,
    Filter(
        DAB,
        If(
            IsEmpty(ComboBox4.SelectedItems.'Level 1 Function'),
Current_Category = "D" && Fiscal = "FY19/20", Current_Category = "D" && Fiscal = "FY19/20" && 'Level 1 Function (AP19/20)' in ComboBox4.SelectedItems.'Level 1 Function' ) ), If( !IsEmpty(ComboBox4.SelectedItems.'Level 1 Function'), Filter( DAB, 'Level 1 Function (AP19/20)' in ComboBox4.SelectedItems.'Level 1 Function' )/*,
DAB*/ ) )

 

The last /*,DAB*/ is optional if you want to show all items in the Gallery when the Toggle is off and no items are selected in the ComboBox. Make sure you remove the Comment Block parts /* and */. If you don't want to use that you can just leave it out or leave it with the Comment Block parts intact for later optional use.

Let me know if this does the trick for you.

southafrican
Level: Powered On

Re: Combo Box filtering Gallery when toggle is true

Thank you, this solved the problem. 

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,441)