- 3 minutes to read

Formula - Equal

equal(<Expression>,<Content>,...,<Content>,<MatchAllValues>) Formula function used to check whether two or more text(string) are equal or not, this function return true when strings matches.

Parameters

  • <Expression> - 'string' or an expression giving back exactly one match.
  • <Content> - one or more values to compare with the first parameter expression.
  • <MatchAllValues> - boolean value true or false. If all the values of each <Content> must match with the expression, default is false, only one of the values if more than one must match. If set to true all values of all <Content> must match.

Quick example

Let's get you started with the following example: For other, and more advanced examples please scroll down on this page to the Examples section.

Input Expression Result

  GMT


equal('GMT',body)

true
Text Data equal expression Unique values

Features

  • Check if two word/character are the same.
  • Return Unique true when matches regardless of the number of matches occurred per evaluation.
  • Can be applied to any valid Content that returns text/string; Like jsonpath, xpath functions, review Formula user guide for the complete list of functions.

This plugin loads the entire message into RAM, so make sure to apply this function only on small messages.

How to use

To use the equal function, the Content parameter should contain text/string (otherwise it will fail and you will end up with a garbage result). But first and foremost we have to configure the Formula plugin:

  • Select Formula as the expression type plugin.
  • Write down the expression to use in the 'Expression' text area.
  • Input proper Content as a parameter to the function.

Syntax

Use the equal function with any of the following parameters:

  • From Message Body: equal('Expression',body)

  • From Message Context: equal('Expression',context('MessageContextKey'))

  • Result from previous Formula operation equal('Expression',SomeOtherNestedFormulaFunction(Content))

Examples

Below you will find different common examples of how to use the equal function.

Body as Content

The message body is normal text "GMT", by using the provided expression, the result is true.

e.g. equal('GMT',body)
equal_simpleParameter

Message Body


 GMT

Expression


equal('GMT',body)


Context as Content

"GMT" is the Message context value and the key is "id", by using the provided expression, the result is true. e.g. equal('GMT', context('id'))

Simple equal_MessageContext

Message Context Value


GMT

Expression


equal('GMT', context('id'))


Formula Function as Content

Regex function has been used as a content parameter for equal function, by using the provided expression, the result is true.

e.g. equal('UTC',regex('GMT|UTC',body))

equal_nested_body

Message Body


GMT UTC

Expression


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


Next Step

How to Add or manage Search Fields
How to Add or manage Log Views

Expression Type Plugins are used in Search Fields
What are Search Fields?
What are Search Field Expressions?
What are Message Types?
What are Log Views?