Node split
The split
node is used to divide an incoming message into multiple messages. It is particularly useful when working with arrays, where each element needs to be processed separately.
Settings for the split
node
1. Name
A field for specifying the name of the node.
The name is displayed in the workspace and helps to easily identify the node.
If left empty, the node will be called split
.
Example:
- Node name:
split items
2. Property
Specifies which property of the message object msg
will be used for splitting.
Example:
msg.payload
msg.items
3. Length
Defines how many parts the message will be divided into.
Example:
- 2
Input Data
The node accepts the msg
object.
Which specific properties will be checked is set in the Property field.
Output Data
Each element of the incoming message will be sent as a separate message. The msg.parts
contains information about the position of the element in the original message.
Example msg.parts
:
{
"id": "12345",
"index": 0,
"count": 3
}
Usage Examples
Example 1: Splitting an array
Flow:
[inject] ---> [split] ---> [debug]
Incoming message:
{
"payload": ["apple", "banana", "cherry"]
}
Result: The split
node will send three separate messages with msg.payload
: apple
, banana
, cherry
.