How to filter by multiple inputs without creating a condition for every single permutation

Hi there!

I’m showing search results in a repeating group (see below screenshot), and I want the user to be able to apply multiple filters to narrow down the results. I’ve before used conditionals to enable a user to filter, which worked fine with 2 filter variables, as there could only be 3 permutations> filter 1, filter 2, and filter 1 AND 2. However, now I want to add filters 3 and 4 into the mix, which means I would have to create a buckload of conditionals for every single permutation:

  • Only 1
  • Only 2
  • Only 3
  • Only 4
  • 1 and 2
  • 1 and 2 and 3
  • 1 and 2 and 3 and 4
  • 2 and 3
  • 2 and 3 and 4
    and so on.

Is there a smarter way to approach this where I don’t need to add a conditional for every permutation?

Some screenshots below and what I’m doing now.
User interface below. User can filter for “when to go”, “when to come back”, “which weekends”, “which countries”

So far, I’ve solved this with conditionals. E.g. when there’s an input in input field 1, then filter by it, when there is an input in input field 2, then filter by it, when there’s an input in input field 1 and 2, then filter by both of them.

No need for any conditions here…

Just check the ‘Ignore Empty Constraints’ box on the search… (although if you’re using advanced filters, that won’t work… but you can create your expressions in such a way that you can still ignore empty constraints, even with advanced filters).

Perfect @adamhholmes , thank you so much!

1 Like