Toggle filter with multiple conditions

  • 1
  • Problem
  • Updated 3 years ago
  • Solved
I have built a toggle filter on a table on a field entitled "Buyer". "Buyer" is a lookup to the user object. I want to show when the running user Id is in the buyer field and when the field is blank. the goal is  when filter is enabled it will show the running user records and the blank records. 

The conditions on the model:

1st condition: Buyer field is = running user id, default off filterable
2nd condition: Buyer field is = blank, default off filterable

Toggle Conditions: Activate the two above conditions

When I add one condition to the toggle filter it works. When I add both filters it breaks. Has anyone run into this? 
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
wouldn't you want 1 condition where buyer field is either user id OR blank instead of two separate conflicting conditions. Activating these two conditions simultaneously would cause them to fight, wouldn't it? Condition 1 would filter out blanks and condition 2 would filter out user id so the result would be 0 records.
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
I tried doing it in one condition as well and that didn't work.

I created a new model entitled "RunningUser" for the user record. Set a condition to Id=User Id of running user, always on

I set the condition on the model that have my buyer field to multiple specific values. I left the first value blank and set the second value to {{$Model.RunningUser.data.0.Id}} 

I activated this one condition in my toggle filter. It yielded no results.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I think this answer is pretty simple. 

Add grouping logic to your conditions with an OR statement between the 2 conditions you are using in your toggle fitler.  That will make records that are returned by either condition show up in your list. 



Just note that your Grouping Logic statement needs to include all conditions - even those that are "filterable default off"
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
Thank you Rob!  knew it was something simple. I tried everything except the condition grouping. Hopefully this will help someone else.