Expressions

Comparison Operators

4min

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:

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




Updated 28 Jul 2023
Doc contributor
Did this page help you?