Text Functions
Mappings: Functions and Expressions · Updated July 15, 2025
Concatenate
Description
- Appends two or more strings together to form a single value.
Syntax
CONCATENATE(string1, [string2, ...])Examples
-
CONCATENATE("I","<",3,"Data")returnsI<3Data -
CONCATENATE(source.order_no,"-",source.payment_status)returns the order number and payment status from a source, separated by a hyphen (-)
Ends With
Description
- Returns whether a string (or list of strings) ends with a given suffix. Returns
TRUEorFALSE(or a list).
Syntax
ENDS_WITH(search, suffix)Examples
-
ENDS_WITH("foo","o")returnsTRUE -
ENDS_WITH(["foo","bar","baz"],"o")returns[TRUE, FALSE, FALSE]
Find and Search
Description
- Returns the first location of the search string within the value using a case-sensitive search.
⚠️ The Find function is case-sensitive, while the Search function is case-insensitive.
Syntax
FIND(search_for, text_to_search, [starting_at])
or
SEARCH(search_for, text_to_search, [starting_at])-
This is a 1-based function, meaning the first position in a string is
1 -
starting_atis optional and defaults to position1 -
This expression returns the position irrespective of the
starting_atposition (see examples below) -
This expression returns
0if thetext_to_searchis not found in thesearch_forstring
ℹ️ FIND and SEARCH are synonymous and can be used interchangeably
Examples
-
FIND("f","foo")andSEARCH("f","foo")each return1 -
FIND("f","foo",2)andSEARCH("f","foo",2)each return an error message (
To ensure that an error message does not break a mapping expression, try wrapping the statement in an If Error function for error handling) -
FIND("o","foo")andSEARCH("f","foo")each return2 -
FIND("o","foo",2)andSEARCH("o","foo",2)each return2 -
FIND("o","foo",3)andSEARCH("o","foo",3)each return3 -
FIND("f","Foo")returns0, whileSearch("f","Foo")returns1(
Find is case-sensitive, while Search is case-insensitive)
Hash (SHA256)
Description
- Returns the hash of a string using the SHA-256 algorithm. This function returns 32 bytes.
Syntax
SHA256(string)Examples
-
SHA256("Hello world")returns64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c -
SHA256("splett2@splett.net")returnsa5ec0df3d9a3b7b98eef1f7766d92b3cda046cdc458dfb8903e856f8c02ddc7d -
⚠️
SHA256(null)(or any null input) returns an error:Type not supported for SHA256
Join
Description
- Concatenates the elements of one or more one-dimensional arrays using a specified delimiter.
Syntax
JOIN(delimiter, value_or_array1, [value_or_array2, ...])Examples
-
JOIN("-",305,555,2218)returns305-555-2218 -
JOIN("_",source.first_name,source.last_name)concatenates thefirst_nameandlast_nameattributes in source data, separated by an underscore (_) -
JOIN(" > ",source.department,source.category,source.subcategory,source.style)returns a string consisting of[department] > [category] > [subcategory] > [style]
Left
Description
- Returns a substring from the beginning of a specified string or list of strings.
Syntax
LEFT(string, [number_of_characters])-
number_of_charactersis optional and defaults to1if not specified
Examples
-
LEFT("David",2)returnsDa -
LEFT("David")returnsD -
LEFT(["David","Copperfield"],2)returns[Da, Co]
Length
Description
- Returns the length of a string or list.
Syntax
LEN(text_or_list)Examples
-
LEN("foo")returns3 -
LEN("David Copperfield")returns17 -
LEN(["foofaraw","barbell","bazel"])returns3 -
LEN([235,32,24462]returns3
Lower
Description
- Converts a specified string to lowercase.
Syntax
LOWER(text)Examples
-
LOWER("DAVID COPPERFIELD")returnsdavid copperfield -
LOWER("David Copperfield")returnsdavid copperfield
Proper
Description
- Capitalizes each word in a specified string.
Syntax
PROPER(text_to_capitalize)Examples
-
PROPER("DAVID COPPERFIELD")returnsDavid Copperfield -
PROPER("david copperfield")returnsDavid Copperfield
Regular Expression Extract
Description
- Extracts matching substrings according to a regular expression.
ℹ️ More info on Regular Expressions can be found here:
Syntax
REGEXEXTRACT(text, reg_ex)Examples
-
REGEXEXTRACT("foo","[f]")returnsf -
REGEXEXTRACT(source.id,"[0-9]+")returns all numeric characters from theidattribute in source data
Regular Expression Match
Description
- Returns whether a piece of text matches a regular expression. Returns
TRUEorFALSE.
ℹ️ More info on Regular Expressions can be found here:
ℹ️ This function is often used within If functions.
Syntax
REGEXMATCH(text, reg_ex)Examples
-
REGEXMATCH("foo","[f]")returnsTRUE -
REGEXMATCH("foo","[0-9]")returnsFALSE -
REGEXMATCH("foo","bar")returnsFALSE
Regular Expression Replace
Description
- Replaces part of a text string with a different text string using regular expressions.
ℹ️ More info on Regular Expressions can be found here:
Syntax
REGEXREPLACE(text, reg_ex, replace)Examples
-
REGEXREPLACE("foo123","[0-9]","")returnsfoo -
REGEXREPLACE(source.phone_number,"[^0-9]", "")returns only the numeric characters in thephone_numberfield in the source data
Replace
Description
- Replaces part of a text string with a different text string, with an optional position parameter to replace text starting at a specific position within a string.
Syntax
REPLACE(text, search, replace, [position])-
textis the string in which something will be replaced -
searchis the string within thetextto replace -
replaceis the string replacing the thesearchstring -
positionis optional and refers to the position at which the replacement will begin (starting at 1); omit the position parameter to replace a string at any position of thetextor an entire string.
Examples
-
REPLACE("foo","o","")returnsf -
REPLACE("SoundCommerce","Commerce","ies",6)returnsSoundies -
REPLACE("SoundCommerce","Commerce","ies",7)returnsSoundCommerce
Right
Description
- Returns a substring from the end of a specified string or list of strings.
Syntax
RIGHT(string, [number_of_characters])-
number_of_charactersis optional and defaults to1if not specified
Examples
-
RIGHT("David",2)returnsid -
RIGHT("David")returnsd -
RIGHT(["David","Copperfield"],2)returns[id, ld]
Split
Description
- Splits the value by the delimiter, returning a list of all elements that were split. It can optionally only split the first instance of the delimiter. It can also optionally remove any empty results.
- To select a specific string within the list, add the offset (starting from 1) within square brackets after the function (e.g. to select the first string in the split list, enter
SPLIT(value,delimiter)[1]).
Syntax
SPLIT(value, delimiter, [split_by_each], [remove_empty])[[1-based offset]]-
split_by_eachistrueby default, and determines whether or not to dividevalueby every instance of thedelimiter -
remove_empty_textistrueby default, and determines whether or not to remove empty text messages from the split results
Examples
-
SPLIT("305-555-0882","-")returns[305,555,0882] -
SPLIT("305-555-0882","-",false)returns[305,555-0882] -
SPLIT("305-555- 0882","-",true,false)returns[305,555, 0882] -
SPLIT("305-555-0882","-")[0]returns305 -
SPLIT(source.input_event_scid,":")[2]returns the third string of theinput_event_scidsource metafield when separated by a colon (:)
Starts With
Description
- Returns whether a string (or list of strings) begins with a given prefix. Returns
TRUEorFALSE(or a list).
Syntax
STARTS_WITH(search, prefix)Examples
-
STARTS_WITH("foo","f")returnsTRUE -
STARTS_WITH(["foo","bar","baz"],"f")returns[TRUE, FALSE, FALSE]
String
Description
- Converts any value to a string.
Syntax
STRING(value)Examples
-
STRING(1)returns1
Switch
Description
- Tests an expression against a list of cases and returns the corresponding value of the first matching case, with an optional default value if nothing else is met. If no default value is provided, input values that do not match any cases will error
Syntax
SWITCH(expression, case1, value1, [case2, value2,] [default] ...)Examples
-
SWITCH(1, 1, true, null)returnstrue -
SWITCH("remove space","remove-hyphen","removehyphen","remove space","removespace",null)returnsremovespace -
SWITCH("remove-hyphen","remove-hyphen","removehyphen",null)returnsremovehyphen -
Importance of adding a default:
-
SWITCH("removespace","remove-hyphen","removehyphen")returns an error -
SWITCH("removespace","remove-hyphen","removehyphen",null)returnsnull
-
Text Join
Description
- Concatenates the elements of one or more one-dimensional arrays using a specified delimiter, optionally ignoring nulls.
Syntax
TEXTJOIN(delim, ignore_empty, [value, ...])Examples
-
TEXTJOIN("-",true,123,456,"",789)returns123-456-789 -
TEXTJOIN("-",false,123,456,"",789)returns123-456--789
To JSON
Description
- Converts a specified object or JSON blob to a JSON string.
Syntax
TO_JSON(value)Examples
-
TO_JSON({"hello":"goodbye"})returns"{\"hello\": \"goodbye\"}" -
TO_JSON("hello")returns an error, because the input is a string and not an object or JSON blob
Trim
Description
- Removes leading and trailing spaces in a specified string.
Syntax
TRIM(text)Examples
-
TRIM(" hello ")returnshello
Upper
Description
- Converts a specified string to uppercase.
Syntax
UPPER(text)Examples
-
UPPER("david copperfield")returnsDAVID COPPERFIELD