common.filter

filter

Allows to filter the records of a table.

type

object

properties

  • combinator

Determines if only one of the rules, or all of them should pass to include a record in the filter results.

type

string

enum

and, or

default

and

  • not

Negates the rules

type

boolean

default

False

  • rules

Array of rules that should be applied to the filter. It can contain a nested filter as can be seen in the example.

type

array

items

oneOf

filter

booleanRule

arrayFieldRule

numericCollectionRule

numericRule

objectRule

stringCollectionRule

stringRule

minItems

1

additionalProperties

False

Examples

myTableField:
  filter:
    rules:
      - field: firstName
        operator: isNull
      - field: lastName
        operator: isNotNull
      - field: lastName
        operator: in
        value: [Perez, Sanchez]
      - field: lastName
        operator: notIn
        value: [Suarez, Juarez]
      - field: age
        operator: =
        value: 30
      - field: age
        operator: "!="
        value: 20
      - field: age
        operator: <
        value: 40
      - field: age
        operator: ">"
        value: 20
      - field: age
        operator: <=
        value: 40
      - field: age
        operator: ">="
        value: 20
      - field: lastName
        operator: contains
        value: e
      - field: lastName
        operator: beginsWith
        value: P
      - field: lastName
        operator: endsWith
        value: z
      - field: lastName
        operator: doesNotContain
        value: h
      - field: lastName
        operator: doesNotBeginWith
        value: A
      - field: lastName
        operator: doesNotEndWith
        value: A
      - field: isActive
        operator: =
        value: true
      - field: isActive
        operator: =
        value: false
      - field: numbers
        operator: includes
        value: 5
      - field: numbers
        operator: doesNotInclude
        value: 5
      - field: roles
        operator: includes
        value: manager
      - field: roles
        operator: doesNotInclude
        value: manager

It supports nested filters:

myTableField:
  filter:
    rules:
      - combinator: or
        rules:
          - combinator: and
            rules:
              - field: firstName
                operator: isNotNull
              - field: lastName
                operator: isNotNull
          - combinator: and
            rules:
              - field: firstName
                operator: contains
                value: a
              - field: lastName
                operator: contains
                value: b

Can negate the conditions:

myTableField:
  filter:
    combinator: and
    not: true
    rules:
      - combinator: and
        not: true
        rules:
          - field: firstName
            operator: isNotNull
          - field: lastName
            operator: isNotNull
      - combinator: and
        rules:
          - field: firstName
            operator: contains
            value: a
          - field: lastName
            operator: contains
            value: b

See: