Skip to main content

ConcatFormat

This Script is part of the Filters And Transformers Pack.#

Supported versions

Supported Cortex XSOAR versions: 6.5.0 and later.

Returns a string concatenated with given prefix & suffix which supports DT expressions.

Script Data#


NameDescription
Script Typepython3
Tagstransformer, general, string
Cortex XSOAR Version6.5.0

Inputs#


Argument NameDescription
valueThe text to be concatenated with prefix & suffix
prefixA prefix to concat to the start of the argument
suffixA prefix to concat to the end of the argument
ctx_dataContext Data: Input . (single dot) on `From previous tasks` to enable to extract the context data.
ctx_inputs`inputs` context: Input 'inputs' (no quotation) on `From previous tasks` to enable ${inputs.} expression in DT.
ctx_inc`demisto` context: Input 'incident' (no quotation) on `From previous tasks` to enable ${incident.} expression in DT.
variable_markersThe pair of start and end markers to bracket a variable name
keep_symbol_to_nullSet to true not to replace a value if the variable is null, otherwise false.

Outputs#


There are no outputs for this script.

Getting Started#


The transformer concatenates prefix and suffix which supports DT expressions to the string.

Examples#


Build an email address from a user ID by appending a domain#

Parameters#

Argument NameValueNote
valuejdoe
prefix
suffix@${domain}
ctx_data.Make sure that From previous tasks is selected
ctx_inputs
ctx_inc
variable_markers
keep_symbol_to_null

Context Data#

{
"domain": "paloaltonetworks.com"
}

Output#

jdoe@paloaltonetworks.com

Build an email address by adding a user ID to the domain#

Parameters#

Argument NameValueNote
valuepaloaltonetworks.com
prefix${userid}@
suffix
ctx_data.Make sure that From previous tasks is selected
ctx_inputs
ctx_inc
variable_markers
keep_symbol_to_null

Context Data#

{
"userid": "jdoe"
}

Output#

jdoe@paloaltonetworks.com

Change the variable start and end marker to the windows command shell style such as %name%.#

Parameters#

Argument NameValueNote
valuepaloaltonetworks.com
prefix%userid%@
suffix
ctx_data.Make sure that From previous tasks is selected
ctx_inputs
ctx_inc
variable_markers%,%
keep_symbol_to_null

Context Data#

{
"userid": "jdoe"
}

Output#

jdoe@paloaltonetworks.com

Change the variable start and end marker to the UNIX shell style such as $name.#

Parameters#

Argument NameValueNote
valuepaloaltonetworks.com
prefix$userid@
suffix
ctx_data.Make sure that From previous tasks is selected
ctx_inputs
ctx_inc
variable_markers$
keep_symbol_to_null

Context Data#

{
"userid": "jdoe"
}

Output#

jdoe@paloaltonetworks.com

Keep variable names if they are missing in the context.#

Parameters#

Argument NameValueNote
valuepaloaltonetworks.com
prefix${userid}@
suffix
ctx_data.Make sure that From previous tasks is selected
ctx_inputs
ctx_inc
variable_markers
keep_symbol_to_nulltrue

Context Data#

{
}

Output#

${userid}@paloaltonetworks.com

Use DTs to build variables.#

Parameters#

Argument NameValueNote
valuepaloaltonetworks.com
prefix${userid=val.toUpperCase()}@
suffix
ctx_data.Make sure that From previous tasks is selected
ctx_inputs
ctx_inc
variable_markers
keep_symbol_to_null

Context Data#

{
"userid": "jdoe"
}

Output#

JDOE@paloaltonetworks.com

Use nested DTs to build variables.#

Parameters#

Argument NameValueNote
valueJohn Doe
prefixHello,
suffix. ${message-${messageID}}
ctx_data.Make sure that From previous tasks is selected
ctx_inputs
ctx_inc
variable_markers
keep_symbol_to_null

Context Data#

{
"message-1": "This is a test message.",
"messageID": 1
}

Output#

Hello, John Doe. This is a test message.