cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Resolver II
Resolver II

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
Highlighted
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?

Highlighted
Frequent Visitor

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.

Highlighted
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?

 

 

Highlighted
Resolver II
Resolver II

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
Resolver II
Resolver II

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.

Highlighted
Frequent Visitor

Re: Combo Box filtering Gallery when toggle is true

Thank you, this solved the problem. 

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,518)