Skip to content

Filtering

Many resources can be filtered. Filters can be combined and nested.

graphql
query LargeFloors {
  getFloors(where: { area: { gte: 3000 } }) {
    floors {
      id
      name
      area
    }
  }
}
query LargeFloors {
  getFloors(where: { area: { gte: 3000 } }) {
    floors {
      id
      name
      area
    }
  }
}

Floor filter

Properties a floor can be filtered by:

ts
{
  id: Number
  area: NumberComparator
  name: StringComparator
  createdAt: DateComparator
  updatedAt: DateComparator
  spaces: SpaceFilter
  elements: ElementFilter
  customAttribute: CustomAttributeFilter
  label: LabelFilter
  isPrivate: Boolean
  seatCapacity: SeatCapacityFilter
  or: [FloorFilter]
  and: [FloorFilter]
}
{
  id: Number
  area: NumberComparator
  name: StringComparator
  createdAt: DateComparator
  updatedAt: DateComparator
  spaces: SpaceFilter
  elements: ElementFilter
  customAttribute: CustomAttributeFilter
  label: LabelFilter
  isPrivate: Boolean
  seatCapacity: SeatCapacityFilter
  or: [FloorFilter]
  and: [FloorFilter]
}

Space filter

Properties a space can be filtered by:

ts
{
  id: Number
  area: NumberComparator
  name: StringComparator
  program: StringComparator
  usage: StringComparator
  seatCapacity: NumberComparator
  elements: ElementFilter
  customAttribute: CustomAttributeFilter
  count: NumberComparator
  or: [SpaceFilter]
  and: [SpaceFilter]
}
{
  id: Number
  area: NumberComparator
  name: StringComparator
  program: StringComparator
  usage: StringComparator
  seatCapacity: NumberComparator
  elements: ElementFilter
  customAttribute: CustomAttributeFilter
  count: NumberComparator
  or: [SpaceFilter]
  and: [SpaceFilter]
}

space.program and space.usage follows Space Taxonomy

Element filter

Properties of an element can be filtered by:

ts
{
  type: StringComparator
  count: NumberComparator
  product: ProductFilter
  customAttribute: CustomAttributeFilter
}
{
  type: StringComparator
  count: NumberComparator
  product: ProductFilter
  customAttribute: CustomAttributeFilter
}

Product filter

Properties of a product can be filtered by:

ts
{
  name: StringComparator
  category: StringComparator
  subCategory: StringComparator
  customAttribute: CustomAttributeFilter
}
{
  name: StringComparator
  category: StringComparator
  subCategory: StringComparator
  customAttribute: CustomAttributeFilter
}

Custom attribute filter

Custom attributes can be filtered by:

ts
{
  key: StringComparator
  value: StringComparator
  title: StringComparator
}
{
  key: StringComparator
  value: StringComparator
  title: StringComparator
}

Seat capacity filter

Seat capacity can be filtered by:

ts
{
  area: NumberComparator
  name: StringComparator
  program: StringComparator
  usage: StringComparator
  seatCapacity: NumberComparator
  elements: ElementFilter
  customAttribute: CustomAttributeFilter
  or: [SpaceFilter]
  and: [SpaceFilter]
  capacity: NumberComparator
}
{
  area: NumberComparator
  name: StringComparator
  program: StringComparator
  usage: StringComparator
  seatCapacity: NumberComparator
  elements: ElementFilter
  customAttribute: CustomAttributeFilter
  or: [SpaceFilter]
  and: [SpaceFilter]
  capacity: NumberComparator
}

product.category and product.subCategory follows Product Taxonomy

Comparators

You can use the following comparators on string, numeric, and date fields:

String comparator

Comparatordescription
eqEquals the given value
neqNot equal to the given value
inValue is in the given collection of values
ninValue is not in the given collection of values
containsContains the given value

Number comparator

Comparatordescription
eqEquals the given value
neqNot equal to the given value
lteLess than or equal to the given value
gteGreater than or equal to the given value

Date comparator

Comparatordescription
eqEquals the given value
neqNot equal to the given value
lteLess than or equal to the given value
gteGreater than or equal to the given value

Optional values additionally support the null comparator, which can be used to return entities depending on whether the field has a value or not. The following query will return all floors that don't have a label:

graphql
query FloorsWithNoLabels {
  getFloors(filter: { labels: { null: true } }) {
    floors {
      id
      labels {
        title
      }
    }
  }
}
query FloorsWithNoLabels {
  getFloors(filter: { labels: { null: true } }) {
    floors {
      id
      labels {
        title
      }
    }
  }
}

Filtering by relationship

You can for instance filter for spaces within the floor filter.

"Show me all floors with two meeting rooms"

graphql
query FloorsWithTwoMeetingRooms {
  getFloors(where: { spaces: { program: { eq: "meet" }, count: 2 } }) {
    floors {
      id
      name
      area
      spaces(where: { program: { eq: "meet" } }) {
        id
        name
        program
      }
    }
  }
}
query FloorsWithTwoMeetingRooms {
  getFloors(where: { spaces: { program: { eq: "meet" }, count: 2 } }) {
    floors {
      id
      name
      area
      spaces(where: { program: { eq: "meet" } }) {
        id
        name
        program
      }
    }
  }
}

You can query for relations of relations

graphql
query FloorsWith {
  getFloors(
    where: {
      spaces: {
        program: { eq: "meet" }
        elements: {
          type: { eq: "element:asset" }
          count: 5
          product: { category: { eq: "seating" } }
        }
      }
    }
  ) {
    floors {
      id
      name
      area
    }
  }
}
query FloorsWith {
  getFloors(
    where: {
      spaces: {
        program: { eq: "meet" }
        elements: {
          type: { eq: "element:asset" }
          count: 5
          product: { category: { eq: "seating" } }
        }
      }
    }
  ) {
    floors {
      id
      name
      area
    }
  }
}