website logo
👥 Community🎯 Samples on GitHub🚦System Status
💡 Guides
🚀 Examples
🍕 Developer Reference
⚡️ Changelog
🎥 Video Library
Navigate through spaces
⌘K
Examples Overview
Setting up your solution
Jig Types
Components
Datasource
Actions
Preview
Widgets
Expressions
Aggregation
Boolean
Comparison Operators
Date & Time
Path Operators
Functional Programming
Jigx Variables
Predicate Queries
String
Docs powered by
Archbee
Expressions

Comparison Operators

5min

Use JSONata comparison operators to compare values in your data and return a Boolean result (true or false) based on the comparison result, or use them for conditional logical expressions.

Comparison operators

The operators used for comparing data are:

  • = (Equals)
  • != (Not equals)
  • > (Greater than)
  • < (Less than)
  • >= (Greater than or equals)
  • <= (Less than or equals)
  • in (Inclusion)

Configuration

Result

Expression

Statement is true

value: "=@ctx.datasources.mydata.color = 'blue' and @ctx.datasources.mydata.number2 != 0 ? 'Statement is true':'Statement is false'"

Be careful when using complex expressions, such as expressions that iterate one datasource across another, as your solution performance could become slower. To avoid this, try to use the datasource queries to get the desired result rather than an expression.



Examples and code snippets 

Comparison operators
Comparison operators


In this example the color and number2 values are compared, if the color is blue and the vlaue of number2 is not equal to zero then the expression evalutes to True.

See the full code sample in GitHub.

expression.jigx
|
datasources:
  mydata: 
    type: datasource.static
    options:
      data:
        - name: Jane Stevens
          title: Doctor
          email: jane@first.com
          number: 0.64734
          number2: 12
          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: Compare expression
            value: "=@ctx.datasources.mydata.color = 'blue' and @ctx.datasources.mydata.number2 != 0 
                    ? 'Statement is true':'Statement is false'"




Updated 28 Jul 2023
Did this page help you?
PREVIOUS
Boolean
NEXT
Date & Time
Docs powered by
Archbee
TABLE OF CONTENTS
Comparison operators
Configuration
Examples and code snippets
Docs powered by
Archbee
Copyright © 2023 Jigx, Inc. All rights reserved. Terms of Service