The Split component is a component that splits the input Payload by line feed if it is a string, or by element if it is a JSON array, and passes it to the next component.
The Split component provides the ability to filter whether the output data after the split is passed to the next component or not.
The conditions can be entered as expressions.
The following two variables are available in this component’s expression. Note, since they are locally used variables, we do not require the cv.
prefix.
Variable name | Meaning of the variable |
---|---|
Value | The actual data value after the splitting process |
Index | Indicates the index of the element in case there were multiple elements |
Conditional Example | Formula |
---|---|
Pass only elements that begin with abc to the next component | Value =~ "^abc" |
Pass only the even-numbered elements. | Index % 2 == 0 |
Parameters
Expr | Required | Expr |
---|---|---|
Encoding | Required | Encoding |
Example
If the incoming cv.Payload
is ["a", "b", "c", "d", "e"]
, the Split component will split it into 5 payloads each submitted to the next component if the expression is true
for all of them. In the above case, the Value is a
for Index 0
and the Value is b
for Index 1
.
Need more help with this?
Join our slack community for help