Skip to content

Filtering on multiple categories — using or

Prerequisite

Basic understanding of filtering FamilySymbols by category.

Often a rule should apply to more than one category. For example: doors or windows.

In JSONata, this is done using the or operator inside the filter condition.


Original filter (single category)

(
  $[type = "FamilySymbol" and values.category.label = "OST_Doors"].{
    "id": id,
    "type": type,
    "name": name,
    "assemblyCode": values.assemblyCode
  }
)

This selects only door types.


Extended filter — doors or windows

To include windows, extend the condition using or:

(
  $[
    type = "FamilySymbol"
    and (
      values.category.label = "OST_Doors"
      or values.category.label = "OST_Windows"
    )
  ].{
    "id": id,
    "type": type,
    "name": name,
    "assemblyCode": values.assemblyCode
  }
)

Why the parentheses matter

The parentheses around the category conditions are required.

Without them:

type = "FamilySymbol"
and values.category.label = "OST_Doors"
or values.category.label = "OST_Windows"

This would be interpreted as:

(FamilySymbols that are doors) or (anything that is a window)

Which is not what you want.

Always group or conditions explicitly.


How to read this filter (plain language)

“Select FamilySymbols that are either Doors or Windows, and return their ID, type, name, and Assembly Code.”

Nothing more. Nothing less.


Common mistakes to avoid

Forgetting parentheses

type = "FamilySymbol" and values.category.label = "OST_Doors" or values.category.label = "OST_Windows"

❌ Incorrect — logic is ambiguous.


Mixing API labels and UI names

values.category.label = "Doors"

❌ Wrong — must use OST_Doors.


Copy-pasting without thinking

or values.category.label = "OST_Windows"

Without grouping — fragile and often wrong.


Alternative (when many categories are needed)

When the list grows, prefer a list-based check:

values.category.label in ["OST_Doors", "OST_Windows"]

Used inside the filter:

(
  $[
    type = "FamilySymbol"
    and values.category.label in ["OST_Doors", "OST_Windows"]
  ].{
    "id": id,
    "type": type,
    "name": name,
    "assemblyCode": values.assemblyCode
  }
)

This is:

  • Easier to read
  • Easier to extend
  • Less error-prone

Rule of thumb

Use or for a small number of explicit cases. Use lists when the set grows or is configurable.