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

Filtering on multiple fields-refreshing a criteria when the selection criteria is deselected from a combobox

So, good people, I have a conundrum; I want to filter a gallery by multiple criteria depending on whether the criteria are selected.

 

I have this code:

 

 

Filter(
        colMeeting,
        If(
            IsBlank(FMLocationCombo.SelectedItems),
            true,
            MeetingLocation=First(FMLocationCombo.SelectedItems).Title
        ),
        If(
            IsEmpty(FMStartDatePicker.SelectedDate),
            true,
            InteractionStartDate=FMStartDatePicker.SelectedDate
        )
)

 

 

This works really well, thanks to a previous question and solution.

 

Here's the rub, it doesn't work if I then deselect the location from the combo box. Its as if something remains in the Combo box, like an empty string.

 

If I select just a date, I get a list of meetings for that date, regardless of the location. If I then select a location, I correctly get the meetings for that date and location. BUT, if I then deselect the location I expect to again get the set of results I got from just selecting the date; what I actually get is an empty set of results.

 

Why? How do I solve this.

 

For context, I also want to extend this code to include another selection from another combo box and then further to populate a 3rd combo box with a list of people and include that into the mix.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Boom_Meringue
Frequent Visitor

Re: Filtering on multiple fields-refreshing a criteria when the selection criteria is deselected from a combobox

Solved:

 

Filter(
        colMeeting,
        If(
            CountRows(FMLocationCombo.SelectedItems)<1,
            true,
            MeetingLocation=First(FMLocationCombo.SelectedItems).Title
        ),
        If(
            IsEmpty(FMStartDatePicker.SelectedDate),
            true,
            InteractionStartDate=FMStartDatePicker.SelectedDate
        )
)

View solution in original post

4 REPLIES 4
WarrenBelz Community Champion
Community Champion

Re: Filtering on multiple fields-refreshing a criteria when the selection criteria is deselected from a combobox

Hi @Boom_Meringue ,

Try

Filter(
   colMeeting,
   If(
      IsEmpty(FMLocationCombo),
      MeetingLocation=First(FMLocationCombo.SelectedItems).Title,
      IsEmpty(FMStartDatePicker.SelectedDate),
      InteractionStartDate=FMStartDatePicker.SelectedDate
   )
)

 

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.

Boom_Meringue
Frequent Visitor

Re: Filtering on multiple fields-refreshing a criteria when the selection criteria is deselected from a combobox

@WarrenBelz 

 

Thanks for taking the time to reply, but unfortunately that hasn't worked.

 

With that code I get no results at all.

Boom_Meringue
Frequent Visitor

Re: Filtering on multiple fields-refreshing a criteria when the selection criteria is deselected from a combobox

Solved:

 

Filter(
        colMeeting,
        If(
            CountRows(FMLocationCombo.SelectedItems)<1,
            true,
            MeetingLocation=First(FMLocationCombo.SelectedItems).Title
        ),
        If(
            IsEmpty(FMStartDatePicker.SelectedDate),
            true,
            InteractionStartDate=FMStartDatePicker.SelectedDate
        )
)

View solution in original post

WarrenBelz Community Champion
Community Champion

Re: Filtering on multiple fields-refreshing a criteria when the selection criteria is deselected from a combobox

Hi @Boom_Meringue ,

Glad you got it gong - not on PC and could not test - the direction was right but I think should have been

Filter(
   colMeeting,
   If(
      IsEmpty(FMLocationCombo.SelectedItems.Value),
      MeetingLocation=First(FMLocationCombo.SelectedItems).Title,
      IsEmpty(FMStartDatePicker.SelectedDate),
      InteractionStartDate=FMStartDatePicker.SelectedDate
   )
)

 

Helpful resources

Announcements
secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (7,293)