- 3 minutes to read

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

🎯 Design Note: The Length() function returns the character count of values extracted from your data.


What does the Length formula do?

The Length() formula returns the length (character count) 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.

graph LR A["Input: Values"] --> B["Length()"] B --> C["Result: Character Count"]

Examples

Below are practical examples showing exactly what input is used, the formula expression, and the resulting output.

Example 1: XML Message Body

Input - Example 1

<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 Expression - Example 1

Length(xpath('Orders/Order/City', body))

Result - Example 1

8

Example 2: Plain Text Body

Input - Example 2

Nodinite

Formula Expression - Example 2

Length(body)

Result - Example 2

8

simpleBody

The result is 8 because the message body contains 8 characters.


Example 3: Message Context Value

Input - Example 3

demo001

Formula Expression - Example 3

Length(context('id'))

Result - Example 3

7

messageContext

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 Expression

Length(jsonpath('a[*].b', body))

Result

4, 2, 14

jsonpath

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.


How to use the Length formula

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])

Next step