Skip to content
Documentation
Updated 3 minutes to read
Markdown

The equal function, one of the Logical functions in the Formula plugin for Search Field Expressions, returns true when the content equals the expression.

Compare the order currency with equal, with a match, a mismatch, and a different case, animated walkthrough (7.12)
Animated walkthrough: on the JSON Order Received event of order ORD-10005 in the Order-to-Cash demo, equal('USD', jsonPath('$.currency', body)) returns true. With 'SEK' there is no value, not false, and with 'usd' there is no value either, because the comparison is case-sensitive.

equal('expression', content [, content ...] [, matchAllValues])
Parameter Required Description
'expression' ✅ Yes The text to compare with, in single quotes, for example 'GMT'.
content ✅ Yes The value or values to check: body, context, or another Formula function such as regex. When you give several content arguments, each of them must match.
matchAllValues ❌ No Unquoted true or false (default). Applies when one content argument returns several values: false means at least one value must match, true means every value must match. A quoted 'true' is not the flag; it is compared as text.
  • true when the content equals the expression.
  • When it doesn't, there is no value: Test Expression shows Processed with warning: The Expression yields no result.
  • The comparison is case-sensitive: equal('gmt', body) on the body GMT returns no value. This differs from regex, which ignores case.
  • When one content argument returns several values, one matching value is enough, unless matchAllValues is true.

Quoting, nesting, and how content is resolved are described in the Formula language rules.

Message Body:

GMT
equal('GMT', body)
true

Test Expression with equal('GMT',body) on the message body GMT, returning true (7.12)
The message body is exactly GMT, so equal returns true.

Message Context:

Key Value
id GMT
equal('GMT', context('id'))
true

Test Expression with equal('GMT',context('id')) on the context key id with value GMT, returning true (7.12)
The context value of id is GMT, so equal returns true.

Example 3: Check values extracted by another function

Section titled “Example 3: Check values extracted by another function”

Message Body:

GMT UTC
equal('UTC', regex('GMT|UTC', body))
true

Test Expression with equal('UTC',regex('GMT|UTC',body)) on the message body GMT UTC, returning true (7.12)
regex extracts GMT and UTC; one of them equals UTC, so equal returns true.

Example 4: Check several message context values

Section titled “Example 4: Check several message context values”

Message Context:

Key Value
id GMT
id2 UTC
equal('UTC', context(regex('id.*')))
true

Test Expression with equal('UTC',context(regex('id.*'))) on the context keys id and id2, returning true (7.12)
context(regex('id.*')) returns the values of both keys, GMT and UTC; one of them equals UTC, so equal returns true.

Example 5: Require every extracted value to match

Section titled “Example 5: Require every extracted value to match”

Message Body:

<Items>
<Item>Hello World</Item>
<Item>Hello World</Item>
</Items>
equal('Hello World', xPath('Items/Item', body), true)
true

The unquoted true is matchAllValues: every Item must equal Hello World. If one Item held another text, the formula would return no value, while the same formula without true would still return true.

Test Expression tab: equal('Hello World', xPath('Items/Item', body), true) on two Hello World items returns true (7.12)
Both Item values equal Hello World, so the check passes even when every value must match.

...

Version:
Release date: N/A
Loading...

Explore Nodinite for 30 days – completely free

  • Find out why this is the leading O&M software
  • Prove your business case
  • Test the self-service for the business side

Loading...

See how Nodinite resolves your technical issues, in a LIVE Demo!

Once you submit this request:

  • We will give you a short call to understand the issues you want to tackle.
  • Understand solutions you have tried and why were you not happy with them.
  • Book a convenient slot for a LIVE demo!

Loading...