Formula - Count
Easily count unique values from your data using the count Formula in Nodinite. This page provides clear, real-world examples with a new, easy-to-read layout that separates input, formula, and result.
✅ Instantly count unique 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 count() function returns the number of unique values extracted from your data.
What does the count formula do?
The count() formula returns the number of unique 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.
Examples
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>
<Order>
<Id>1338</Id>
<Amount>42</Amount>
<City>Paris</City>
<Partner>QWNtZQ==</Partner>
</Order>
</ns0:Orders>
Formula Expression
count(xpath('Orders/Order/Id', body))
Result
2
Example 2: Plain Text Body
Input
Nodinite
Formula Expression
count(body)
Result
1
The result is 1 because the message body contains a single value.
Example 3: Message Context Value
Input
Nodinite
Formula Expression
count(context('id'))
Result
1
The result is 1 because the context value for 'id' is a single value.
Example 4: JSON with Nested Formula
Input
{"a":[{"b":"This"},{"b":"is"},{"b":"Formula Plugin"}]}
Formula Expression
count(jsonpath('a[*].b', body))
Result
3
The result is 3 because there are three unique values in the JSON array.
Features
- Count unique values from any Content
- Works with XML, JSON, plain text, or any valid formula plugin
- Returns the count 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 count formula
Syntax
- From Message Body:
count(body) - From Message Context:
count(context('MessageContextKey')) - From Nested Formula:
count(SomeOtherFormula(Content))
Next step
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?
- Other Math formulas: average, length, max, min, sum


