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
    }
  }
}

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]
}

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]
}

space.program and space.usage follow Space Taxonomy

Adjacent space grouping filter

Properties a space grouping can be identified by:

ts
{
  area: NumberComparator
  name: StringComparator
  program: StringComparator
  usage: StringComparator
  seatCapacity: NumberComparator
  elements: ElementFilter
  customAttribute: CustomAttributeFilter
  count: Int!
  connectivity: Int
  adjacentSpaces: AdjacentSpaceFilter
}

program and usage follow Space Taxonomy
count represents a desired number of adjacent spaces
connectivity represents the <= amount of doors between adjacent spaces
adjacentSpaces represents related adjacent spaces following Adjacent Space Filter

Example:
"Find a meeting room next to 2 adjacent private offices which are connected through the same corridor (2 doors)."

graphql
query Floors {
  getFloors {
    floors {
      id
      name
      adjacentSpaces(
        where: {
          adjacentSpaces: {
            count: 1
            usage: { eq: "meetingRoom" }
            adjacentSpaces: { count: 2, connectivity: 2, usage: { eq: "privateOffice" } }
          }
        }
      ) {
        id
        name
        usage
      }
    }
  }
}

Adjacent space filter

Properties an adjacent space can be filtered by:

ts
{
  area: NumberComparator
  name: StringComparator
  program: StringComparator
  usage: StringComparator
  seatCapacity: NumberComparator
  elements: ElementFilter
  customAttribute: CustomAttributeFilter
  count: Int!
  connectivity: Int
}

program and usage follow Space Taxonomy
count represents a desired number of adjacent spaces
connectivity represents the <= amount of openings (doors) between adjacent spaces

Element filter

Properties of an element can be filtered by:

ts
{
  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
}

Custom attribute filter

Custom attributes can be filtered by:

ts
{
  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
}

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
      }
    }
  }
}

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
      }
    }
  }
}

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
    }
  }
}