Transformers use operators to enable you to transfer or render one value to another value in Cortex XSOAR.
Transformers enable you to take one value and transform or render it to another value. When you have more than one transformer, you can reorder them using click-and-drag.
Note the following:
Transformers try to cast the transformed value (and arguments) to the necessary type. Tasks will fail if casting has failed, for example
{“some”: “object”}
To upper case =>Error
.Some transformers are applied on each item of the result. For example,
a, b, c
To upper case =>A, B, C
.Some transformers operate on the entire list. For example,
a, b, c
count =>3
.Some transformers are implemented as automations (meaning custom transformers automation with the
transformer
tag. You can find examples in the automation description. For more information about creating custom transformers, see Create Custom Filter and Transformer Operators.
Transformer Categories
Date: Transforms the date. For example:
Name | Description | Example |
---|---|---|
Date to string | Converts any date to a specified string format. The date input must be in ISO format. For example,
The following are available output format options:
This transformer is in GO language. |
|
Date to Unix | Converts any date to Unix format. See Filter Operators for a list of supported time and date formats. |
|
General: Includes general transformers, such as sort, splice, stringify, etc. The following table describes the General examples:
Name | Description | Example |
---|---|---|
Unique | Returns a de-duped version of a list. |
|
Slice | Returns part of a specified list in a range of
|
|
Slice by item | Returns part of a list specified in a range of from item (included) through to item (not included).
|
|
Sort | Sorts an entire list. Supports strings and numbers. descending:
|
=> |
Get index | Get item at the given index.
|
|
Splice | Adds or removes items to/from an array.
|
=> |
Index of | Returns the first index of the element in the array, or -1 if not found.
|
|
Get field | Extracts a given field from the given object.
|
|
Stringify | Converts the given item to a string. |
|
Count | Returns the number of elements. |
|
Join | Concatenates all elements.
|
|
String: Transforms strings. To make regex case non-sensitive, use the (?i)
prefix (for example (?i)yourRegexText
. The following table describes string examples.
Name | Description | Example |
---|---|---|
replace match | Returns a string with some or all matches of a regex pattern, and replaces with a specified string. regex: A regex pattern to be replaced by the replaceWith argument. replaceWith: The string that replaces the string specified in the toReplace argument, default is an empty string. Detailed RegEx syntax can be found at https://github.com/google/re2/wiki/Syntax. |
|
Substring | Returns a subset of a string between one index and another, or through the end of the string. from (required): An integer between 0 and the length of the string, specifying the offset into the string of the first character to include in the returned substring. to (optional): An integer between 0 and the length of the string, which specifies the offset into the string of the first character not to include in the returned substring. |
|
Split | Splits a string into an array of strings, using a specified delimiter string to determine where to make each split. delimiter: Specifies the string which denotes the points at which each split should occur, default delimiter is |
=> |
Split & trim | Splits a string into an array of strings and removes whitespace from both ends of the string, using a specified delimiter string to determine where to make each split.Argumentsdelimiter: Specifies the string which denotes the points at which each split should occur (default delimiter is |
|
From string | Returns a subset of a string from the first from string occurrence. from (required): String to substring from. |
|
To string | Returns a subset of a string until the first to string occurrence. to (required): String to substring until. |
|
concat | Returns a string concatenated with given prefix and suffix. prefix: A prefix to concat to the start of the argument. suffix: A suffix to concat to the end of the argument. |
|
Number: Transforms a number. Examples:
Name | Description | Example |
---|---|---|
Floor | Returns the highest integer less than or equal to the number. |
|
Ceil | Returns the lowest integer greater than or equal to the number. |
|
Round | Returns the nearest integer, rounding half way from zero. |
|
Absolute | Returns the absolute value of the given number. |
|
Decimal precision | Truncates the number of digits after the decimal point, according to the by argument. by: Number of digits to keep after the decimal point, default is 0. |
|
Modulus (remainder) | The modular operator (%) returns the division remainder. by (required): Modulo by, default:0 |
|
To percent | Converts a number to a percent. withsign: Specify true to include %. Default is false |
|
Quadratic equation | Returns the result of the Quadratic Formula.b (required): The b number of: ax2 + bx + c = 0, default is 0.c (required): The c number of: ax2 + bx + c = 0, default is 0. |
|