Formula - Length
Easily get the length of values from your data using the Length Formula in Nodinite. This page provides clear, real-world examples with a new, easy-to-read layout that separates input, formula, and result.
✅ Instantly measure the length of values from message body, Context, or nested formulas
✅ Use with XML, JSON, or plain text data
✅ Boost your integration insights with unique, reliable results
What is the Length formula?
The Length()
formula returns the length of values extracted from your data. Use it to analyze message payloads, context values, or results from other formulas in your log views and search fields.
Syntax
- From Message Body:
Length(body, [bool unique = true])
- From Message Context:
Length(context('MessageContextKey'), [bool unique = true])
- From Nested Formula:
Length(SomeOtherFormula(Content), [bool unique = true])
Examples: Input, Formula, and Result
Below are practical examples showing exactly what input is used, the formula expression, and the resulting output.
Example 1: XML Message Body
Input
<ns0:Orders xmlns:ns0="SupplyChain.Schemas/1.0">
<Order>
<Id>1337</Id>
<Amount>666</Amount>
<City>New York</City>
<Partner>QWNtZQ==</Partner>
</Order>
</ns0:Orders>
Formula
Length(xpath('Orders/Order/City', body))
Result
8
Example 2: Plain Text Body
Input
Nodinite
Formula
Length(body)
Result
8
The result is 8 because the message body contains 8 characters.
Example 3: Message Context Value
Input
demo001
Formula
Length(context('id'))
Result
7
The result is 7 because the context value for 'id' is 7 characters long.
Example 4: JSON with Nested Formula
Input
{"a":[{"b":"This"},{"b":"is"},{"b":"Formula Plugin"}]}
Formula
Length(jsonpath('a[*].b', body))
Result
4, 2, 14
The result is 4, 2, and 14 because the extracted values have those lengths.
Features
- Get the length of values from any Content
- Works with XML, JSON, plain text, or any valid formula plugin
- Returns the length of unique values only
- Ideal for integration analytics and data validation in Nodinite
Important: This plugin loads the entire message into RAM. For best performance, use it only on small messages.
Next Steps
Related Topics
- 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?