- 2 minutes to read

Formula - concat

The concat Formula function returns all its arguments joined, in order, into one string.

Syntax

concat(content, ..., content)

Parameters

Parameter Required Description
content Yes, two or more The parts to join: static text in single quotes, body, context, or the result of another function, such as jsonPath or substring.

Returns

One string with the arguments joined in the order you list them, with no separator. To add a separator, pass it as static text: concat(body, '-', context('id')).

That holds when every argument has one value. When an argument returns several values, concat returns one string per value, each joined with the other arguments. On {"orderId":"ORD-10005","lines":[{"sku":"A"},{"sku":"B"}]}, concat(jsonPath('orderId', body), ' / ', jsonPath('lines[*].sku', body)) returns two values, ORD-10005 / A and ORD-10005 / B, and concat(jsonPath('lines[*].sku', body), '|') returns A| and B|.

Examples

Example 1: Join two static strings

Input

None; the formula uses only static text.

Formula

concat('formula','Plugin')

Result

formulaPlugin

Test Expression tab: concat('formula','Plugin') returns formulaPlugin (7.12)
Static text works without a message body; case is kept as written.

Example 2: Append static text to the message body

Input

Nod

Formula

concat(body,'inite')

Result

Nodinite

Test Expression tab: concat(body,'inite') returns Nodinite for the message body Nod (7.12)
The body comes first because it's the first argument.

Example 3: Repeat the message body

Input

Hey

Formula

concat(body,body)

Result

HeyHey

Test Expression tab: concat(body,body) returns HeyHey for the message body Hey (7.12)
The same source can be used more than once.

Example 4: Prepend static text to a context property

Input

Key Value
id ination

Formula

concat('Imag',context('id'))

Result

Imagination

Test Expression tab: concat('Imag',context('id')) returns Imagination for the context value ination (7.12)
Static text and the value of the context property id are joined.

Example 5: Join the result of jsonPath and static text

Input

Key Value
id { "Id": 2 }

Formula

concat(jsonPath('Id',context('id')),'A')

Result

2A

Test Expression tab: concat of jsonPath on a JSON context value and 'A' returns 2A (7.12)
jsonPath reads Id from the JSON in the context property, and concat appends A.

Example 6: Join two nested functions

Input

Message body:

gmt

Message context:

Key Value
id utc

Formula

concat(toUpperCase(regex('gmt|utc', body)), toUpperCase(substring(0,3, context('id'))))

Result

GMTUTC

Test Expression tab: concat of toUpperCase(regex) on the body and toUpperCase(substring) on the context returns GMTUTC (7.12)
The first argument uppercases the regex match in the body; the second uppercases the first three characters of the context value.

Message Context tab with the key id and the value utc (7.12)
The context property id used by the second argument in Example 6.

Next Steps