Predicate Queries

Use JSONata Predicate Queries at any location path; the selected items can be filtered using a predicate - <expr> where expr evaluates to a Boolean value. With that, you can select values from the array based on the specific type set as the predicate expression.

Configuration

Result
Expression

Evaluate if true and show the name

[email protected][title='Nurse' and color='blue'].name

Examples and code snippets

Predicate queries
Predicate queries

In this example the expression is used to show the name of the nurse whose color is blue.

See the full code sample in GitHub.

expression.jigx
datasources:
  mydata: 
    type: datasource.static
    options:
      data:
        - name: Jane Stevens
          title: Doctor
          email: [email protected]
          number: 0.64734
          number2: 12
          color: blue
          time: '2021-11-07T15:07:54.972Z'
          array: [5,1,2,3,7,9]
        - name: Arthur Marks
          title: Nurse
          email: [email protected]
          number: 0.98
          number2: 10
          color: red
          time: '2021-11-07T15:07:54.972Z'
          array: [5,1,2,3,7,9]
        - name: Merley Shanks
          title: Nurse
          email: [email protected]
          number: 0.43
          number2: 9
          color: blue
          time: '2021-11-07T15:07:54.972Z'
          array: [5,1,2,3,7,9]
children:
  - type: component.entity
    options:
      children:
        - type: component.entity-field
          options:
            label: Predicate expression
            value: [email protected][title='Nurse' and color='blue'].name

Last updated

Was this helpful?