Supported transformation functions - Data cleansing
No-code Transformation formulas for Data cleansing.
In the formula input, you can can write basic or complex expression to transform the data. Expressions are composed of either a value, a function, an operation, or another expression in parenthesis. See below for the description of each one of them.
Functions can be nested, ex: SHA256(LOWER(user.email))
Available functions
FUNCTION NAME | WHAT IT DOES | Example |
---|---|---|
EXTRACT(text, delimiter, position) | Extracts from the given text the substring at the given position, after splitting by the given delimiter. |
|
SUBSTITUTE(text, search_text,substitute_text) | Substitutes new_text for old_text in a text string. Use SUBSTITUTE when you want to replace specific text in a text string. |
|
REPLACE(sourceStr, pattern, replaceStr) | Replaces every match of pattern (a regex expression) in sourceStr. |
|
SHA256(stringToHash) | Returns an SHA256 hash of the given string |
|
MD5(stringToHash) | Returns an MD5 hash of the given string |
|
COALESCE(value1, value2, ...) | Returns the first value from the list that isn’t empty |
|
CONCAT(string1, string2, ...) | Concatenate multiple values into one property. Separators could be specified: CONCAT(prop1, " | ", prop2, " |
TRIM(text) | Removes all spaces, new lines, tabulations at the beginning and at the end of a text. |
|
SELECT(sourceStr, pattern, <position>) | Returns the first match of the pattern (a regex expression) in sourceStr. If the third parameter is set, it will return the corresponding group inside the match. |
|
LOWER(text) | Converts all uppercase letters in a text string to lowercase |
|
UPPER(text) | Converts all lowercase letters in a text string to uppercase |
|
NUMBER(value1) | Converts string to number |
|
ENCODE_BASE64(value1) | Encode a string to base64 |
|
DECODE_BASE64(value1) | Decode a string from base64 |
|
TIMESTAMP() | Returns the current date timestamp |
|
LEFT(text, length) | Returns the requested number of characters from the beginning of a string or number. |
|
RIGHT(text, length) | Returns the requested number of characters from the end of a string or number. |
|
CHAR(text, position)* | Returns the character at the specified position (start at 0). |
|
IF(condition,resultIfTrue,resultIfFalse) | Returns the second argument if the first argument is true, or the third argument otherwise |
|
ISEMPTY(value) | Returns whether the value is empty or not | ISEMPTY("abc") returns false |
SIZE(array or object) | Returns the number of elements in the list |
|
LENGTH(string) | Returns the number of characters in the string |
|
SUBSTRING(text, pos1, pos2) | Returns a new string composed of the characters between the two position defined by pos1 and pos2. The positions start at 0. If a negative number is given, the positions start from the end of the string. If pos2 is omitted, the end of the string is used. |
|
JSON_PARSE(string) | Parse a JSON string. Usefull to create an object property that will contain all the properties present inside a stringyfied JSON you may have inside another event property |
|
VALUE_FROM_JSON(string, path) | Extract a value from a data string formatted in JSON |
returns
|
GET(property name) | GET(name) return the value of the given event property. Useful for property names that contains a special character like "-" |
returns
|
GETHEADER(name) | GETHEADER(name) return the value of the given http header |
returns
|
GETCOOKIE(name) | GETCOOKIE(name) return the value of the given http cookie |
returns
|
DATEPARSE(str, format) | Takes a date in a specific format and converts it to a proper date |
|
DATEFORMAT(date, format) | Takes a date in a ISO-8601 format and converts it to the specified format |
|
DATEADD(date, interval, unit) | Adds the interval as a unit (years, months, weeks, days, hours, minutes, seconds) |
|
DATESUB(date, interval, unit) | Removes the interval as a unit (years, months, weeks, days, hours, minutes, seconds) |
|
DATEDIFF(date1, date2, unit) | Returns the interval between two dates in unit |
|
AGE(date, unit) | Returns the elapsed time since the given date in unit (if unit is not specified, years by default) |
|
YEAR(date), MONTH(date), DAY(date), HOUR(date), MINUTES(date), SECONDS(date) | Returns the dates specified unit |
|
TIMEZONE(date) | Returns the timezone in UTC |
|
TODAY() | Returns the current date in ISO-8601 |
|
Operators
Operator | Description | Example |
=, == | Return true if the left part is equal to the right part. If one of the part is an array, check if some values are in equal between the two parts. |
|
!=, <> | Inverse of the above |
|
AND or && | Do a boolean AND between the two parts |
|
OR or || | Do a boolean OR between the two parts |
|
NOT(expression) | Do a boolean NOT on the expression |
|
IN() | Returns true if the left is equals to at least one value on the right. |
|
!IN | Returns true if none of the value on the right is equal to the value on the left. |
|
<, >, <=, or >= | Compare two values If one of the values is an array, check that at least one of the value match. |
|
BETWEEN() | Check if the left value is between the two values passed as arguments.If the left value is an array, check that at least one of the value match. |
|
EXISTS() | Check if the property exists |
|
~ or !~ | Check if the left value match the regex in the right value (or doesn’t match if !~). The regex language is the javascript one. If the left value is an array, check that at least one of the value match. |
|
STARTSWITH(), ENDSWITH(), or CONTAINS() | Check if the left value starts with, ends with, or contains the right value. If the left value is an array, check that at least one of the value match. |
|
* or / | Multiplication or division |
|
+ or - | Addition / concatenation or substraction |
|
Examples
Scenario: Create a Flag that shows if Consumers’ Primary Address is in California
IF(EXTRACT(city_state, '-', 1) == " CA", "TRUE", "FALSE")
Scenario: Set a value with multiple conditions. The value equals "12345" for country FR and environment prod, else equals 98888 for country DE and environment dev: \
Last updated