- 4 minutes to read

Formula - concat

Concatenate strings from extracted values.

concat(1st Parameter,2nd parameter) Formula function used to concat a specific char/word with another char/word, the result contains the 1st Parameter + 2nd parameter as one string.

Quick example

Let's get you started with the following example: For other, and more advanced examples please scroll down on this page to the Examples section.

Input Expression Result




concat('Formula','Plugin')

FormulaPlugin
Text Data concat expression Unique values

Features

  • Works just like any other concatenation method you have worked on in any common programming language.
  • Can be applied to any valid Content that returns string text; Like jsonpath, xpath or any Formula plugin functions, review Formula user guide for a complete list of functions.

Important

This plugin loads the entire message into RAM, so make sure to apply this function only on small messages.

How to use

To use the concat function, the Content parameter should contain a text/string (otherwise it will fail and you will end up with nothing). But first and foremost we have to configure the Formula plugin:

  • Select Formula as the expression type plugin.
  • Write down the expression to use in the 'Expression' text area.
  • Input proper Content as a parameter to the function.

Syntax

Use the concat function with any of the following parameters:

  • Standalone parameters:
    concat(1st Parameter,2nd Parameter)

  • From Message Body: concat(1st Parameter,body) OR concat(body,2nd Parameter)

  • From Message Context: concat(1st Parameter,context('MessageContextKey')) OR concat(context('MessageContextKey'), 2nd Parameter)

  • Result from previous Formula operation replace(NestedFormulaFunction,NestedFormulaFunction)

Examples

Below you will find different common examples of how to use the concat function.

Standalone Parameter(No body required)

Simply pass any strings as first parameter and second parameter to the concat function. Lets pass 'formula' as first parameter and 'Plugin' as second parameter, by using the provided expression, the result is formulaPlugin.

e.g. concat('formula','Plugin')

standaloneParameters

Body as Content

"Nod" is the body content, by using the provided expression, the result is Nodinite.

e.g. concat(body,'inite')

firstParameterFromBody

Message Body


 Nod

Expression


concat(body,'inite')

Notice that you can simply use body as first or second parameter and for user who just want to concat the body with itself just pass the body for both parameters as below:

e.g. concat(body,body)

body as Parameter


Context as Content

"ination" is the Message Context value and the key is "id", by using the provided expression, the result is Imagination.

e.g. concat('Imag',context('id'))

contextAsContent

Message Context Value


  ination

Expression


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


Notice that context() can apply to any concat() parameter.Furthermore, it can be applied as the first and second parameters at the same time in order to concat the value with itself.

Formula Function as Content

Body context is json array the Content parameter is jsonpath function, by using the provided expression, the result is 2A.

e.g. concat(jsonpath('Id',context('id')),'A')

functionAsContextParameter

Message Body


{ "Id": 2 }

Expression


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


More advance example

The given expression with the provided text will return GMC as a result.

e.g. concat(regex('GM',body),regex('C',body))

Functions As Parameters

Message Body


GMT UTC

Expression


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


You can target both the Message Body and Message Context and concat their values in one value. In the below example we have "gmt" small letters as the message body and we have "UTC" as value for corresponding key "id", by applying the given expression the result is GMTUTC.

e.g. concat(touppercase(regex('gmt|utc', body)), touppercase(substring(0,3, context('id'))))

Nested Functions As Parameters

Message Context

Message Body


gmt

Message Context Value


utc

Expression


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


Next Step

How to Add or manage Search Fields
How to Add or manage Log Views

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?