Formula  Length
Tip
An example of reallife usage, use the Length function to get an alert if a field has less (or more) then X characters
The Length( )
Formula function is a pretty straightforward and selfexplanatory function. It is used to return the length of the value(s) extracted from the Content part.
Quick example
Let's get you started with the following example: For other and more advanced examples, scroll down on this page to the Examples section.
Input  Expression  Result 



8 
Text Data  Length expression  Unique values 
Features
The Length( )
function can be used on any content, as long as data is returned from the Content
part. It doesn't matter if the content parameter a plain text or any valid Formula Plugin function. Please notice that the numbers returned represents the unique Lengths of the extracted values; more on this later below.
 Return the Length of extracted values from the Content.
 It returns the Length of the unique values from Content.
 It can be applied on the Content part that returns data; Like jsonpath, xpath functions or even a plaintext, review the Formula user guide for the complete list of functions.
Important
This plugin loads the entire message into RAM, so make sure to apply this function only on small messages..
How to use
The Content part should contain data to use the Length function, (otherwise, it will fail, and you will end up with nothing as the result). But first and foremost, you must configure the Formula plugin:
 Select Formula as the expression type plugin.
 Write down the expression to use in the 'Expression' text area.
 Input Content as a parameter to the function.
Syntax
Use the Length function with any of the following parameters:
From Message Body:
Length(body, [bool unique = true])
From Message Context:
Length(context('MessageContextKey'), [bool unique = true])
Result from previous Formula operation
Length(SomeOtherNestedFormulaFunction(Content), [bool unique = true])
Examples
Below, you will find different common examples of how to use the Length function.
Body as Content
"Nodinite" is the message body text; By using the provided expression, the result is 8
.
e.g. Length(body)
Message Body
Nodinite
Expression
Length(body)
Context as Content
"demo001" is the value for the corresponding key "Correlation Id", by using the provided expression, the result is 7
.
e.g. Length(Context('Correlation Id'))
Message Context Value
Nodinite
Expression
Length(context('id'))
Formula Function as Body
The message body is a JSON structure, and by using the provided expression, the result is 4
, 2
, 14
.
e.g. Length(jsonpath('a[*].b', body))
Message Body
{a:[{b:'This'},{b:'is'},{b:'Formula Plugin'}]}
Expression
Length(jsonpath('a[*].b', body))
Next Step
How to Add or manage Search Fields
How to Add or manage Log Views
Related
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?