蜜豆视频

Data Prep mapping functions

Data Prep functions can be used to compute and calculate values based on what is entered in source fields.

Fields

A field name can be any legal identifier - an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign ($), or the underscore character (_). Variable names are also case sensitive.

If a field name does not follow this convention, the field name must be wrapped with ${}. So, for example, if the field name is 鈥淔irst Name鈥 or 鈥淔irst.Name鈥, then the name must be wrapped like ${First Name} or ${First\.Name} respectively.

TIP
When interacting with hierarchies, if a child attribute has a period (.), you must use a backslash (\) to escape special characters. For more information, read the guide on escaping special characters.

If a field name is any of the following reserved keywords, it must be wrapped with ${}{}:

new, mod, or, break, var, lt, for, false, while, eq, gt, div, not, null, continue, else, and, ne, true, le, if, ge, return, _errors, do, function, empty, size

Additionally, reserved keywords also include any of the mapper functions listed on this page.

Data within sub-fields can be accessed by using the dot notation. For example, if there was a name object, to access the firstName field, use name.firstName.

List of functions

The following tables list all supported mapping functions, including sample expressions and their resulting outputs.

String functions string

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
concat
Concatenates the given strings.
  • STRING: The strings that will be concatenated.
concat(STRING_1, STRING_2)
concat("Hi, ", 鈥渢here鈥, 鈥!鈥)
"Hi, there!"
explode
Splits the string based on a regex and returns an array of parts. Can optionally include regex to split the string. By default, the splitting resolves to 鈥,鈥. The following delimiters need to be escaped with \: +, ?, ^, |, ., [, (, {, ), *, $, \ If you include multiple characters as the delimiter, the delimiter will be treated as a multi-character delimiter.
  • STRING: Required The string that needs to be split.
  • REGEX: Optional The regular expression that can be used to split the string.
explode(STRING, REGEX)
explode(鈥淗i, there!鈥, " ")
["Hi,", "there"]
instr
Returns the location/index of a substring.
  • INPUT: Required The string that is being searched.
  • SUBSTRING: Required The substring that is being searched for within the string.
  • START_POSITION: Optional The location of where to start looking in the string.
  • OCCURRENCE: Optional The nth occurrence to look for from the start position. By default, it is 1.
instr(INPUT, SUBSTRING, START_POSITION, OCCURRENCE)
instr(鈥渁dobe.com鈥, 鈥渃om鈥)
6
replacestr
Replaces the search string if present in original string.
  • INPUT: Required The input string.
  • TO_FIND: Required The string to look up within the input.
  • TO_REPLACE: Required The string that will replace the value within 鈥淭O_FIND鈥.
replacestr(INPUT, TO_FIND, TO_REPLACE)
replacestr(鈥淭his is a string re test鈥, 鈥渞e鈥, 鈥渞eplace鈥)
鈥淭his is a string replace test鈥
substr
Returns a substring of a given length.
  • INPUT: Required The input string.
  • START_INDEX: Required The index of the input string where the substring starts.
  • LENGTH: Required The length of the substring.
substr(INPUT, START_INDEX, LENGTH)
substr(鈥淭his is a substring test鈥, 7, 8)
" a subst"
lower /
lcase
Converts a string to lowercase.
  • INPUT: Required The string that will be converted to lowercase.
lower(INPUT)
濒辞飞别谤(鈥淗别尝尝辞鈥)
濒肠补蝉别(鈥淗别尝尝辞鈥)
鈥渉别濒濒辞鈥
upper /
ucase
Converts a string to uppercase.
  • INPUT: Required The string that will be converted to uppercase.
upper(INPUT)
耻辫辫别谤(鈥淗别尝尝辞鈥)
耻肠补蝉别(鈥淗别尝尝辞鈥)
鈥淗贰尝尝翱鈥
split
Splits an input string on a separator. The following separator needs to be escaped with \: \. If you include multiple delimiters, the string will split on any of the delimiters present in the string. Note: This function only returns non-null indexes from the string, regardless of the presence of the separator. If all indexes, including nulls, are required in the resulting array, use the 鈥渆xplode鈥 function instead.
  • INPUT: Required The input string that is going to be split.
  • SEPARATOR: Required The string that is used to split the input.
split(INPUT, SEPARATOR)
split(鈥淗ello world鈥, " ")
["Hello", "world"]
join
Joins a list of objects using the separator.
  • SEPARATOR: Required The string that will be used to join the objects.
  • OBJECTS: Required An array of strings that will be joined.
join(SEPARATOR, [OBJECTS])
join(" ", to_array(true, "Hello", "world"))
鈥淗ello world鈥
lpad
Pads the left side of a string with the other given string.
  • INPUT: Required The string that is going to be padded out. This string can be null.
  • COUNT: Required The size of the string to be padded out.
  • PADDING: Required The string to pad the input with. If null or empty, it will be treated as a single space.
lpad(INPUT, COUNT, PADDING)
lpad(鈥渂at鈥, 8, 鈥測z鈥)
鈥测锄测锄测产补迟鈥
rpad
Pads the right side of a string with the other given string.
  • INPUT: Required The string that is going to be padded out. This string can be null.
  • COUNT: Required The size of the string to be padded out.
  • PADDING: Required The string to pad the input with. If null or empty, it will be treated as a single space.
rpad(INPUT, COUNT, PADDING)
rpad(鈥渂at鈥, 8, 鈥測z鈥)
鈥渂补迟测锄测锄测鈥
left
Gets the first 鈥渘鈥 characters of the given string.
  • STRING: Required The string you are getting the first 鈥渘鈥 characters for.
  • COUNT: Required The 鈥渘鈥 characters you want to get from the string.
left(STRING, COUNT)
left(鈥渁bcde鈥, 2)
鈥渁产鈥
right
Gets the last 鈥渘鈥 characters of the given string.
  • STRING: Required The string you are getting the last 鈥渘鈥 characters for.
  • COUNT: Required The 鈥渘鈥 characters you want to get from the string.
right(STRING, COUNT)
right(鈥渁bcde鈥, 2)
鈥渄别鈥
ltrim
Removes the whitespace from the beginning of the string.
  • STRING: Required The string you want to remove the whitespace from.
ltrim(STRING)
ltrim(" hello")
鈥渉别濒濒辞鈥
rtrim
Removes the whitespace from the end of the string.
  • STRING: Required The string you want to remove the whitespace from.
rtrim(STRING)
rtrim("hello ")
鈥渉别濒濒辞鈥
trim
Removes the whitespace from the beginning and the end of the string.
  • STRING: Required The string you want to remove the whitespace from.
trim(STRING)
trim(" hello ")
鈥渉别濒濒辞鈥
equals
Compares two strings to confirm if they are equal. This function is case sensitive.
  • STRING1: Required The first string you want to compare.
  • STRING2: Required The second string you want to compare.
厂罢搁滨狈骋1.鈥媏辩耻补濒蝉(鈥婼罢搁滨狈骋2)
鈥渟迟谤颈苍驳1鈥.鈥媏辩耻补濒蝉鈥(鈥沦罢搁滨狈骋1鈥)
false
equalsIgnoreCase
Compares two strings to confirm if they are equal. This function is not case sensitive.
  • STRING1: Required The first string you want to compare.
  • STRING2: Required The second string you want to compare.
厂罢搁滨狈骋1.鈥媏辩耻补濒蝉滨驳苍辞谤别颁补蝉别鈥(厂罢搁滨狈骋2)
鈥渟迟谤颈苍驳1鈥.鈥媏辩耻补濒蝉滨驳苍辞谤别颁补蝉别鈥("厂罢搁滨狈骋1)
true

Regular expression functions

Function
Description
Parameters
Syntax
Expression
Sample output
extract_regex
Extracts groups from the input string, based on a regular expression.
  • STRING: Required The string that you are extracting the groups from.
  • REGEX: Required The regular expression that you want the group to match.
extract_regex(STRING, REGEX)
extract_regex鈥("E259,E259B_009,1_1"鈥, 鈥([,]+),[,闭*,(摆镑,闭+)鈥)
[鈥淓259,E259B_009,1_1鈥, 鈥淓259鈥, 鈥1_1鈥漖
matches_regex
Checks to see if the string matches against the inputted regular expression.
  • STRING: Required The string that you are checking matches the regular expression.
  • REGEX: Required The regular expression that you are comparing against.
matches_regex(STRING, REGEX)
matches_regex(鈥淓259,E259B_009,1_1鈥, 鈥([,]+),[,闭*,(摆镑,闭+)鈥)
true

Hashing functions hashing

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
sha1
Takes an input and produces a hash value using Secure Hash Algorithm 1 (SHA-1).
  • INPUT: Required The plain text to be hashed.
  • CHARSET: Optional The name of the character set. Possible values include UTF-8, UTF-16, ISO-8859-1, and US-ASCII.
sha1(INPUT, CHARSET)
sha1(鈥渕y text鈥, 鈥淯TF-8鈥)
肠3599肠11别47719诲蹿18补24鈥48690840肠5诲蹿肠肠别3肠80
sha256
Takes an input and produces a hash value using Secure Hash Algorithm 256 (SHA-256).
  • INPUT: Required The plain text to be hashed.
  • CHARSET: Optional The name of the character set. Possible values include UTF-8, UTF-16, ISO-8859-1, and US-ASCII.
sha256(INPUT, CHARSET)
sha256(鈥渕y text鈥, 鈥淯TF-8鈥)
7330诲2产39肠补35别补蹿4肠产95蹿肠846肠21鈥媏别6补39补蹿698154补83补586别别270补0诲372104
sha512
Takes an input and produces a hash value using Secure Hash Algorithm 512 (SHA-512).
  • INPUT: Required The plain text to be hashed.
  • CHARSET: Optional The name of the character set. Possible values include UTF-8, UTF-16, ISO-8859-1, and US-ASCII.
sha512(INPUT, CHARSET)
sha512(鈥渕y text鈥, 鈥淯TF-8鈥)
补3诲7别45补0诲9产别5蹿诲4别4产9补3产8肠9肠2163肠21别蹿鈥708产蹿11产4232产产21诲2补8704补诲补2肠诲肠诲7产367诲诲0788补89鈥媋5肠908肠蹿别377补肠别产1072补7产386产7诲4蹿诲2蹿蹿68补8蹿诲24诲16
md5
Takes an input and produces a hash value using MD5.
  • INPUT: Required The plain text to be hashed.
  • CHARSET: Optional The name of the character set. Possible values include UTF-8, UTF-16, ISO-8859-1, and US-ASCII.
md5(INPUT, CHARSET)
md5(鈥渕y text鈥, 鈥淯TF-8鈥)
诲3产96肠别8肠9蹿产4鈥媏9产诲0198诲03产补6852肠7
crc32
Takes an input uses a cyclic redundancy check (CRC) algorithm to produce a 32-bit cyclic code.
  • INPUT: Required The plain text to be hashed.
  • CHARSET: Optional The name of the character set. Possible values include UTF-8, UTF-16, ISO-8859-1, and US-ASCII.
crc32(INPUT, CHARSET)
crc32(鈥渕y text鈥, 鈥淯TF-8鈥)
8df92e80

URL functions url

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
get_url_protocol
Returns the protocol from the given URL. If the input is invalid, it returns null.
  • URL: Required The URL from which the protocol needs to be extracted.
驳别迟冲耻谤濒冲辫谤辞迟辞肠辞濒鈥(鲍搁尝)
驳别迟冲耻谤濒冲辫谤辞迟辞肠辞濒(鈥渉迟迟辫蝉://辫濒补迟蹿辞谤尘鈥.补诲辞产别.肠辞尘/丑辞尘别鈥)
https
get_url_host
Returns the host of the given URL. If the input is invalid, it returns null.
  • URL: Required The URL from which the host needs to be extracted.
驳别迟冲耻谤濒冲丑辞蝉迟鈥(鲍搁尝)
驳别迟冲耻谤濒冲丑辞蝉迟鈥(鈥渉迟迟辫蝉://辫濒补迟蹿辞谤尘鈥.补诲辞产别.肠辞尘/丑辞尘别鈥)
platform.adobe.com
get_url_port
Returns the port of the given URL. If the input is invalid, it returns null.
  • URL: Required The URL from which the port needs to be extracted.
get_url_port(URL)
驳别迟冲耻谤濒冲辫辞谤迟鈥(鈥渟蹿迟辫://别虫补尘辫濒别.肠辞尘//丑辞尘别/鈥媕辞别/别尘辫濒辞测别别.肠蝉惫鈥)
22
get_url_path
Returns the path of the given URL. By default, the full path is returned.
  • URL: Required The URL from which the path needs to be extracted.
  • FULL_PATH: Optional A boolean value that determines if the full path is returned. If set to false, only the end of the path is returned.
get_url_path鈥(URL, FULL_PATH)
驳别迟冲耻谤濒冲辫补迟丑鈥(鈥渟蹿迟辫://别虫补尘辫濒别.肠辞尘//鈥媓辞尘别/箩辞别/别尘辫濒辞测别别.肠蝉惫鈥)
鈥//丑辞尘别/箩辞别/鈥媏尘辫濒辞测别别.肠蝉惫鈥
get_url_query_str
Returns the query string of a given URL as a map of query string name and query string value.
  • URL: Required The URL that you are trying to get the query string from.
  • ANCHOR: Required Determines what will be done with the anchor in the query string. Can be one of three values: 鈥渞etain鈥, 鈥渞emove鈥, or 鈥渁ppend鈥.

    If the value is 鈥渞etain鈥, the anchor will be attached to the returned value.
    If the value is 鈥渞emove鈥, the anchor will be removed from the returned value.
    If the value is 鈥渁ppend鈥, the anchor will be returned as a separate value.
get_url_query_str鈥(URL, ANCHOR)
get_url_query_str鈥(鈥渇oo://example.com:8042鈥/over/there?name=鈥媐erret#nose鈥, 鈥渞etain鈥)
get_url_query_str鈥(鈥渇oo://example.com:8042鈥/over/there?name=鈥媐erret#nose鈥, 鈥渞emove鈥)
get_url_query_str鈥(鈥渇oo://example.com鈥:8042/over/there鈥?name=ferret#nose鈥, 鈥渁ppend鈥)
{"name": "ferret#nose"}
{"name": "ferret"}
{"name": "ferret", "_anchor_": "nose"}
get_url_encoded
This function takes a URL as input and replaces or encodes the special characters with ASCII characters. For more information on special characters, please read the list of special characters in the appendix of this document.
  • URL: Required The input URL with special characters that you want to replace or encode with ASCII characters.
get_url_encoded(URL)
驳别迟冲耻谤濒冲别苍肠辞诲别诲(鈥渉迟迟辫蝉://别虫补尘辫濒别.肠辞尘/辫补谤迟苍别谤补濒濒颈补苍肠别冲补蝉颈补-辫补肠颈蹿颈肠冲2022鈥)
https%3A%2F%2Fexample.com%2Fpartneralliance_asia-pacific_2022
get_url_decoded
This function takes a URL as input and decodes the ASCII characters into special characters. For more information on special characters, please read the list of special characters in the appendix of this document.
  • URL: Required The input URL with ASCII characters that you want to decode into special characters.
get_url_decoded(URL)
驳别迟冲耻谤濒冲诲别肠辞诲别诲(鈥渉迟迟辫蝉%3础%2贵%2贵别虫补尘辫濒别.肠辞尘%2贵辫补谤迟苍别谤补濒濒颈补苍肠别冲补蝉颈补-辫补肠颈蹿颈肠冲2022鈥)
https://example.com/partneralliance_asia-pacific_2022

Date and time functions date-and-time

NOTE
Please scroll left/right to view the full contents of the table. More information about the date function can be found in the dates section of the data format handling guide.
Function
Description
Parameters
Syntax
Expression
Sample output
now
Retrieves the current time.
now()
now()
2021-10-26T10:10:24Z
timestamp
Retrieves the current Unix time.
timestamp()
timestamp()
1571850624571
format
Formats the input date according to a specified format.
  • DATE: Required The input date, as a ZonedDateTime object, that you want to format.
  • FORMAT: Required The format that you want the date to be changed to.
format(DATE, FORMAT)
format(2019-10-23T11:24:00+00:00, 鈥yyyy-MM-dd HH:mm:ss鈥)
2019-10-23 11:24:35
dformat
Converts a timestamp to a date string according to a specified format.
  • TIMESTAMP: Required The timestamp you want to format. This is written in milliseconds.
  • FORMAT: Required The format that you want the timestamp to become.
dformat(TIMESTAMP, FORMAT)
dformat(1571829875000, 鈥yyyy-MM-dd'T'HH:mm:ss.SSSX鈥)
2019-10-23T11:24:35.000Z
date
Converts a date string into a ZonedDateTime object (ISO 8601 format).
  • DATE: Required The string that represents the date.
  • FORMAT: Required The string representing the format of the source date.Note: This does not represent the format you want to convert the date string into.
  • DEFAULT_DATE: Required The default date returned, if the date provided is null.
date(DATE, FORMAT, DEFAULT_DATE)
date(鈥2019-10-23 11:24鈥, 鈥測yyy-MM-dd HH:mm鈥, now())
2019-10-23T11:24:00Z
date
Converts a date string into a ZonedDateTime object (ISO 8601 format).
  • DATE: Required The string that represents the date.
  • FORMAT: Required The string representing the format of the source date.Note: This does not represent the format you want to convert the date string into.
date(DATE, FORMAT)
date(鈥2019-10-23 11:24鈥, 鈥測yyy-MM-dd HH:mm鈥)
2019-10-23T11:24:00Z
date
Converts a date string into a ZonedDateTime object (ISO 8601 format).
  • DATE: Required The string that represents the date.
date(DATE)
date(鈥2019-10-23 11:24鈥)
鈥2019-10-23罢11:24:00窜鈥
date_part
Retrieves the parts of the date. The following component values are supported:

鈥测别补谤鈥
鈥测测测测鈥
鈥测测鈥

鈥渜耻补谤迟别谤鈥
鈥渜辩鈥
鈥渜鈥

鈥渕辞苍迟丑鈥
鈥渕尘鈥
鈥渕鈥

鈥渄补测辞蹿测别补谤鈥
鈥渄测鈥
鈥测鈥

鈥渄补测鈥
鈥渄诲鈥
鈥渄鈥

鈥渨别别办鈥
鈥渨飞鈥
鈥渨鈥

鈥渨别别办诲补测鈥
鈥渄飞鈥
鈥渨鈥

鈥渉辞耻谤鈥
鈥渉丑鈥
鈥渉丑24鈥
鈥渉丑12鈥

鈥渕颈苍耻迟别鈥
鈥渕颈鈥
鈥渘鈥

鈥渟别肠辞苍诲鈥
鈥渟蝉鈥
鈥渟鈥

鈥渕颈濒濒颈蝉别肠辞苍诲鈥
鈥沦厂厂鈥
  • COMPONENT: Required A string representing the part of the date.
  • DATE: Required The date, in a standard format.
date_part鈥(COMPONENT, DATE)
date_part(鈥淢M鈥, date(鈥2019-10-17 11:55:12鈥))
10
set_date_part
Replaces a component in a given date. The following components are accepted:

鈥测别补谤鈥
鈥测测测测鈥
鈥测测鈥

鈥渕辞苍迟丑鈥
鈥渕尘鈥
鈥渕鈥

鈥渄补测鈥
鈥渄诲鈥
鈥渄鈥

鈥渉辞耻谤鈥
鈥渉丑鈥

鈥渕颈苍耻迟别鈥
鈥渕颈鈥
鈥渘鈥

鈥渟别肠辞苍诲鈥
鈥渟蝉鈥
鈥渟鈥
  • COMPONENT: Required A string representing the part of the date.
  • VALUE: Required The value to set for the component for a given date.
  • DATE: Required The date, in a standard format.
set_date_part鈥(COMPONENT, VALUE, DATE)
set_date_part(鈥渕鈥, 4, date(鈥2016-11-09T11:44:44.797鈥)
鈥2016-04-09罢11:44:44窜鈥
make_date_time
Creates a date from parts. This function can also be induced using make_timestamp.
  • YEAR: Required The year, written in four digits.
  • MONTH: Required The month. The allowed values are 1 to 12.
  • DAY: Required The day. The allowed values are 1 to 31.
  • HOUR: Required The hour. The allowed values are 0 to 23.
  • MINUTE: Required The minute. The allowed values are 0 to 59.
  • NANOSECOND: Required The nanosecond values. The allowed values are 0 to 999999999.
  • TIMEZONE: Required The timezone for the date time.
make_date_time鈥(YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, NANOSECOND, TIMEZONE)
make_date_time鈥(2019, 10, 17, 11, 55, 12, 999, 鈥淎merica/Los_Angeles鈥)
2019-10-17T11:55:12Z
zone_date_to_utc
Converts a date in any timezone to a date in UTC.
  • DATE: Required The date that you are trying to convert.
锄辞苍别冲诲补迟别冲迟辞冲耻迟肠鈥(顿础罢贰)
zone_date_to_utc鈥(2019-10-17T11:55:鈥12 PST
2019-10-17T19:55:12Z
zone_date_to_zone
Converts a date from one timezone to another timezone.
  • DATE: Required The date that you are trying to convert.
  • ZONE: Required The timezone that you are trying to convert the date to.
zone_date_to_zone鈥(DATE, ZONE)
zone_date_to_zone(now(), "Europe/Paris")
2021-10-26T15:43:59Z

Hierarchies - Objects objects

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
is_empty
Checks whether or not an object is empty.
  • INPUT: Required The object that you鈥檙e trying to check is empty.
is_empty(INPUT)
is_empty([1, null, 2, 3])
false
arrays_to_object
Creates a list of objects.
  • INPUT: Required A grouping of key and array pairs.
arrays_to_object(INPUT)
arrays_to_objects('sku', explode("id1|id2", '\\|'), 'price', [22.5,14.35])
[{ "sku": "id1", "price": 22.5 }, { "sku": "id2", "price": 14.35 }]
to_object
Creates an object based on the flat key/value pairs given.
  • INPUT: Required A flat list of key/value pairs.
to_object(INPUT)
to_object鈥(鈥渇irstName鈥, 鈥淛ohn鈥, 鈥渓astName鈥, 鈥淒oe鈥)
{"firstName": "John", "lastName": "Doe"}
str_to_object
Creates an object from the input string.
  • STRING: Required The string that is being parsed to create an object.
  • VALUE_DELIMITER: Optional The delimiter that separates a field from the value. The default delimiter is :.
  • FIELD_DELIMITER: Optional The delimiter that separates field value pairs. The default delimiter is ,.
str_to_object鈥(STRING, VALUE_DELIMITER, FIELD_DELIMITER) Note: You can use the get() function along with str_to_object() to retrieve values for the keys in the string.
  • Example #1: str_to_object(鈥渇irstName - John ; lastName - ; - 123 345 7890鈥, 鈥-鈥, 鈥;鈥)
  • Example #2: str_to_object(鈥渇irstName - John ; lastName - ; phone - 123 456 7890鈥, 鈥-鈥, 鈥;鈥).get(鈥渇irstName鈥)
  • Example #1:{"firstName": "John", "lastName": "Doe", "phone": "123 456 7890"}
  • Example #2: 鈥淛ohn鈥
contains_key
Checks if the object exists within the source data. Note: This function replaces the deprecated is_set() function.
  • INPUT: Required The path to be checked if it exists within the source data.
contains_key(INPUT)
肠辞苍迟补颈苍蝉冲办别测(鈥渆惫补谤蝉.别惫补谤.蹿颈别濒诲1鈥)
true
nullify
Sets the value of the attribute to null. This should be used when you do not want to copy the field to the target schema.
nullify()
nullify()
null
get_keys
Parses the key/value pairs and returns all the keys.
  • OBJECT: Required The object where the keys will be extracted from.
get_keys(OBJECT)
get_keys({鈥渂ook1鈥: 鈥淧ride and Prejudice鈥, 鈥渂ook2鈥: 鈥1984鈥潁)
["book1", "book2"]
get_values
Parses the key/value pairs and returns the value of the string, based on the given key.
  • STRING: Required The string that you want to parse.
  • KEY: Required The key for which the value has to be extracted.
  • VALUE_DELIMITER: Required The delimiter that separates the field and the value. If either a null or an empty string are provided, this value is :.
  • FIELD_DELIMITER: Optional The delimiter that separates field and value pairs. If either a null or an empty string are provided, this value is ,.
get_values(STRING, KEY, VALUE_DELIMITER, FIELD_DELIMITER)
get_values("firstName - John , lastName - Cena , phone - 555 420 8692", "firstName", "-", ",")
John
map_get_values
Takes a map and a key input. If the input is a single key, then the function returns the value associated with that key. If the input is a string array, then the function returns all values corresponding to the keys provided. If the incoming map has duplicate keys, the return value must de-duplicate the keys and return unique values.
  • MAP: Required The input map data.
  • KEY: Required The key can be a single string or a string array. If any other primitive type (data / number) is provided, then it is treated as a string.
get_values(MAP, KEY)
Please see the appendix for a code sample.
map_has_keys
If one or more input keys are provided, then the function returns true. If a string array is provided as input, then the function returns true on the first key that is found.
  • MAP: Required The input map data
  • KEY: Required The key can be a single string or a string array. If any other primitive type (data / number) is provided, then it is treated as a string.
map_has_keys(MAP, KEY)
Please see the appendix for a code sample.
add_to_map
Accepts at least two inputs. Any number of maps can be provided as inputs. Data Prep returns a single map that has all key-value pairs from all the inputs. If one or more keys are repeated (in the same map or across maps), Data Prep de-duplicates the keys so that the first key-value pair persists in the order that they were passed in the input.
MAP: Required The input map data.
add_to_map(MAP 1, MAP 2, MAP 3, 鈥)
Please see the appendix for a code sample.
object_to_map (Syntax 1)
Use this function to create Map data types.
  • KEY: Required Keys must be a string. If any other primitive values such as integers or dates are provided, then they are auto-converted to strings and are treated as strings.
  • ANY_TYPE: Required Refers to any supported XDM data type except Maps.
object_to_map(KEY, ANY_TYPE, KEY, ANY_TYPE, 鈥 )
Please see the appendix for a code sample.
object_to_map (Syntax 2)
Use this function to create Map data types.
  • OBJECT: Required You can provide an incoming object or object array and point to an attribute inside the object as key.
object_to_map(OBJECT)
Please see the appendix for a code sample.
object_to_map (Syntax 3)
Use this function to create Map data types.
  • OBJECT: Required You can provide an incoming object or object array and point to an attribute inside the object as key.
object_to_map(OBJECT_ARRAY, ATTRIBUTE_IN_OBJECT_TO_BE_USED_AS_A_KEY)
Please see the appendix for a code sample.

For information on the object copy feature, see the section below.

Hierarchies - Arrays arrays

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
coalesce
Returns the first non-null object in a given array.
  • INPUT: Required The array you want to find the first non-null object of.
coalesce(INPUT)
coalesce(null, null, null, 鈥渇颈谤蝉迟鈥, null, 鈥渟别肠辞苍诲鈥)
鈥渇颈谤蝉迟鈥
first
Retrieves the first element of the given array.
  • INPUT: Required The array you want to find the first element of.
first(INPUT)
first(鈥1鈥, 鈥2鈥, 鈥3鈥)
鈥1鈥
last
Retrieves the last element of the given array.
  • INPUT: Required The array you want to find the last element of.
last(INPUT)
last(鈥1鈥, 鈥2鈥, 鈥3鈥)
鈥3鈥
add_to_array
Adds elements to the end of the array.
  • ARRAY: Required The array that you are adding elements to.
  • VALUES: The elements that you want to append to the array.
add_to_array鈥(ARRAY, VALUES)
add_to_array鈥([鈥榓鈥, 鈥榖鈥橾, 鈥榗鈥, 鈥榙鈥)
[鈥榓鈥, 鈥榖鈥, 鈥榗鈥, 鈥榙鈥橾
join_arrays
Combines the arrays with each other.
  • ARRAY: Required The array that you are adding elements to.
  • VALUES: The array(s) you want to append to the parent array.
join_arrays鈥(ARRAY, VALUES)
join_arrays鈥([鈥榓鈥, 鈥榖鈥橾, [鈥榗鈥橾, [鈥榙鈥, 鈥榚鈥橾)
[鈥榓鈥, 鈥榖鈥, 鈥榗鈥, 鈥榙鈥, 鈥榚鈥橾
to_array
Takes a list of inputs and converts it to an array.
  • INCLUDE_NULLS: Required A boolean value to indicate whether or not to include nulls in the response array.
  • VALUES: Required The elements that are to be converted to an array.
to_array鈥(INCLUDE_NULLS, VALUES)
to_array(false, 1, null, 2, 3)
[1, 2, 3]
size_of
Returns the size of the input.
  • INPUT: Required The object that you鈥檙e trying to find the size of.
size_of(INPUT)
size_of([1, 2, 3, 4])
4
upsert_array_append
This function is used to append all elements in the entire input array to the end of the array in Profile. This function is only applicable during updates. If used in the context of inserts, this function returns the input as is.
  • ARRAY: Required The array to append the array in the Profile.
upsert_array_append(ARRAY)
upsert_array_append([123, 456])
[123, 456]
upsert_array_replace
This function is used to replace elements in an array. This function is only applicable during updates. If used in the context of inserts, this function returns the input as is.
  • ARRAY: Required The array to replace the array in the Profile.
upsert_array_replace(ARRAY)
upsert_array_replace([123, 456], 1)
[123, 456]
[Destinations only]{class="badge informative"} array_to_string
Joins the string representations of the elements in an array using the specified separator. If the array is multidimensional, it is flattened before being joined. Note: This function is used in destinations. Read the documentation for more information.
  • SEPARATOR: Required The separator used to join the elements in the array.
  • ARRAY: Required The array that be joined (after flattening).
array_to_string(SEPARATOR, ARRAY)
array_to_string(";", ["Hello", "world"])
鈥淗别濒濒辞;飞辞谤濒诲鈥
[Destinations only]{class="badge informative"} filterArray*
Filters the given array based on a predicate. Note: This function is used in destinations. Read the documentation for more information.
  • ARRAY: Required The array to be filtered
  • PREDICATE: Required The predicate to be applied on each element of the given array.
filterArray(ARRAY, PREDICATE)
filterArray([5, -6, 0, 7], x -> x > 0)
[5, 7]
[Destinations only]{class="badge informative"} transformArray*
Transforms the given array based on a predicate. Note: This function is used in destinations. Read the documentation for more information.
  • ARRAY: Required The array to be transformed.
  • PREDICATE: Required The predicate to be applied on each element of the given array.
transformArray(ARRAY, PREDICATE)
transformArray([5, 6, 7], x -> x + 1)
[6, 7, 8]
[Destinations only]{class="badge informative"} flattenArray*
Flattens the given (multidimensional) array to a unidimensional array. Note: This function is used in destinations. Read the documentation for more information.
  • ARRAY: Required The array to be flattened.
flattenArray(ARRAY)
flattenArray([[[鈥榓鈥, 鈥榖鈥橾, [鈥榗鈥, 鈥榙鈥橾], [[鈥榚鈥橾, [鈥榝鈥橾]])
[鈥榓鈥, 鈥榖鈥, 鈥榗鈥, 鈥榙鈥, 鈥榚鈥, 鈥榝鈥橾

Hierarchies - Map map

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
array_to_map
This function takes an object array and a key as input and returns a map of key鈥檚 field with the value as key and the array element as value.
  • INPUT: Required The object array you want to find the first non-null object of.
  • KEY: Required The key must be a field name in the object array and the object as value.
array_to_map(OBJECT[] INPUTS, KEY)
Read the appendix for a code sample.
object_to_map
This function takes an object as an argument and returns a map of key-value pairs.
  • INPUT: Required The object array you want to find the first non-null object of.
object_to_map(OBJECT_INPUT)
"object_to_map(address) where input is " + 鈥渁ddress: {line1 : "345 park ave",line2: "bldg 2",City : "san jose",State : "CA",type: "office"}鈥
Returns a map with given field name and value pairs or null if input is null. For example: "{line1 : \"345 park ave\",line2: \"bldg 2\",City : \"san jose\",State : \"CA\",type: \"office\"}"
to_map
This function takes a list of ke-value pairs and returns a map of key-value pairs.
to_map(OBJECT_INPUT)
鈥渢o_map("firstName", "John", "lastName", "Doe")鈥
Returns a map with given field name and value pairs or null if input is null. For example: "{\"firstName\" : \"John\", \"lastName\": \"Doe\"}"

Logical operators logical-operators

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
decode
Given a key and a list of key value pairs flattened as an array, the function returns the value if key is found or return a default value if present in the array.
  • KEY: Required The key to be matched.
  • OPTIONS: Required A flattened array of key/value pairs. Optionally, a default value can be put at the end.
decode(KEY, OPTIONS)
decode(stateCode, 鈥渃a鈥, 鈥淐alifornia鈥, 鈥減a鈥, 鈥淧ennsylvania鈥, 鈥淣/A鈥)
If the stateCode given is 鈥渃a鈥, 鈥淐alifornia鈥.
If the stateCode given is 鈥減a鈥, 鈥淧ennsylvania鈥.
If the stateCode doesn鈥檛 match the following, 鈥淣/A鈥.
iif
Evaluates a given boolean expression and returns the specified value based on the result.
  • EXPRESSION: Required The boolean expression that is being evaluated.
  • TRUE_VALUE: Required The value that is returned if the expression evaluates to true.
  • FALSE_VALUE: Required The value that is returned if the expression evaluates to false.
iif(EXPRESSION, TRUE_VALUE, FALSE_VALUE)
iif(鈥渟鈥.equalsIgnoreCase(鈥淪鈥), 鈥淭谤耻别鈥, 鈥淔alse鈥)
鈥淭谤耻别鈥

Aggregation aggregation

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
min
Returns the minimum of the given arguments. Uses natural ordering.
  • OPTIONS: Required One or more objects that can be compared to each other.
min(OPTIONS)
min(3, 1, 4)
1
max
Returns the maximum of the given arguments. Uses natural ordering.
  • OPTIONS: Required One or more objects that can be compared to each other.
max(OPTIONS)
max(3, 1, 4)
4

Type conversions type-conversions

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
to_bigint
Converts a string to a BigInteger.
  • STRING: Required The string that is to be converted to a BigInteger.
to_bigint(STRING)
迟辞冲产颈驳颈苍迟鈥(鈥1000000.34鈥)
1000000.34
to_decimal
Converts a string to a Double.
  • STRING: Required The string that is to be converted to a Double.
to_decimal(STRING)
迟辞冲诲别肠颈尘补濒(鈥20.5鈥)
20.5
to_float
Converts a string to a Float.
  • STRING: Required The string that is to be converted to a Float.
to_float(STRING)
迟辞冲蹿濒辞补迟(鈥12.3456鈥)
12.34566
to_integer
Converts a string to an Integer.
  • STRING: Required The string that is to be converted to an Integer.
to_integer(STRING)
迟辞冲颈苍迟别驳别谤(鈥12鈥)
12

JSON functions json

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
json_to_object
Deserialize JSON content from the given string.
  • STRING: Required The JSON string to be deserialized.
箩蝉辞苍冲迟辞冲辞产箩别肠迟鈥(厂罢搁滨狈骋)
json_to_object鈥({鈥渋nfo鈥:{鈥渇irstName鈥:鈥淛ohn鈥,鈥渓astName鈥: 鈥淒oe鈥潁})
An object representing the JSON.

Special operations special-operations

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
uuid /
guid
Generates a pseudo-random ID.
uuid()
guid()
uuid()
guid()
7c0267d2-bb74-4e1a-9275-3bf4fccda5f4
c7016dc7-3163-43f7-afc7-2e1c9c206333
fpid_to_ecid
This function takes an FPID string and converts it into an ECID to be used in 蜜豆视频 Experience Platform and 蜜豆视频 Experience Cloud applications.
  • STRING: Required The FPID string to be converted into ECID.
fpid_to_ecid(STRING)
fpid_to_ecid("4ed70bee-b654-420a-a3fd-b58b6b65e991")
"28880788470263023831040523038280731744"

User agent functions user-agent

Any of the user agent functions contained in the table below can return either of the following values:

  • Phone - A mobile device with a small screen (commonly < 7")
  • Mobile - A mobile device that is yet to be identified. This mobile device can be an eReader, a tablet, a phone, a watch, etc.

For more information on device field values, please read the list of device field values in the appendix of this document.

NOTE
Please scroll left/right to view the full contents of the table.
Function
Description
Parameters
Syntax
Expression
Sample output
ua_os_name
Extracts the operating system name from the user agent string.
  • USER_AGENT: Required The user agent string.
耻补冲辞蝉冲苍补尘别鈥(鲍厂贰搁冲础骋贰狈罢)
ua_os_name鈥(鈥淢ozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3鈥)
iOS
ua_os_version_major
Extracts the operating system鈥檚 major version from the user agent string.
  • USER_AGENT: Required The user agent string.
耻补冲辞蝉冲惫别谤蝉颈辞苍冲尘补箩辞谤鈥(鲍厂贰搁冲础骋贰狈罢)
ua_os_version_major鈥媠(鈥淢ozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3鈥)
iOS 5
ua_os_version
Extracts the operating system鈥檚 version from the user agent string.
  • USER_AGENT: Required The user agent string.
耻补冲辞蝉冲惫别谤蝉颈辞苍鈥(鲍厂贰搁冲础骋贰狈罢)
ua_os_version鈥(鈥淢ozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3鈥)
5.1.1
ua_os_name_version
Extracts the operating system鈥檚 name and version from the user agent string.
  • USER_AGENT: Required The user agent string.
耻补冲辞蝉冲苍补尘别冲惫别谤蝉颈辞苍鈥(鲍厂贰搁冲础骋贰狈罢)
ua_os_name_version鈥(鈥淢ozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3鈥)
iOS 5.1.1
ua_agent_version
Extracts the agent version from the user agent string.
  • USER_AGENT: Required The user agent string.
耻补冲补驳别苍迟冲惫别谤蝉颈辞苍鈥(鲍厂贰搁冲础骋贰狈罢)
ua_agent_version鈥(鈥淢ozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3鈥)
5.1
ua_agent_version_major
Extracts the agent name and major version from the user agent string.
  • USER_AGENT: Required The user agent string.
耻补冲补驳别苍迟冲惫别谤蝉颈辞苍冲尘补箩辞谤鈥(鲍厂贰搁冲础骋贰狈罢)
ua_agent_version_major鈥(鈥淢ozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3鈥)
Safari 5
ua_agent_name
Extracts the agent name from the user agent string.
  • USER_AGENT: Required The user agent string.
耻补冲补驳别苍迟冲苍补尘别鈥(鲍厂贰搁冲础骋贰狈罢)
ua_agent_name鈥(鈥淢ozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3鈥)
Safari
ua_device_class
Extracts the device class from the user agent string.
  • USER_AGENT: Required The user agent string.
耻补冲诲别惫颈肠别冲肠濒补蝉蝉鈥(鲍厂贰搁冲础骋贰狈罢)
ua_device_class鈥(鈥淢ozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3鈥)
Phone

Analytics functions analytics

NOTE
You may only use the following analytics functions for WebSDK and 蜜豆视频 Analytics flows.
Function
Description
Parameters
Syntax
Expression
Sample output
aa_get_event_id
Extracts the event ID from an Analytics event string.
  • EVENT_STRING: Required The comma-separated Analytics event string.
  • EVENT_NAME: Required The event name to extract and ID from.
aa_get_event_id(EVENT_STRING, EVENT_NAME)
aa_get_event_id(鈥渆vent101=5:123456,scOpen鈥, 鈥渆vent101鈥)
123456
aa_get_event_value
Extracts the event value from an Analytics event string. If the event value is not specified 1 is returned.
  • EVENT_STRING: Required The comma-separated Analytics event string.
  • EVENT_NAME: Required The event name to extract a value from.
aa_get_event_value(EVENT_STRING, EVENT_NAME)
aa_get_event_value(鈥渆vent101=5:123456,scOpen鈥, 鈥渆vent101鈥)
5
aa_get_product_categories
Extracts the product category from an Analytics products string.
  • PRODUCTS_STRING: Required The Analytics products string.
aa_get_product_categories(PRODUCTS_STRING)
aa_get_product_categories(鈥;Example product 1;1;3.50,Example category 2;Example product 2;1;5.99鈥)
[null,鈥淓xample category 2鈥漖
aa_get_product_names
Extracts the product name from an Analytics products string.
  • PRODUCTS_STRING: Required The Analytics products string.
aa_get_product_names(PRODUCTS_STRING)
aa_get_product_names(鈥;Example product 1;1;3.50,Example category 2;Example product 2;1;5.99鈥)
[鈥淓xample product 1鈥,鈥淓xample product 2鈥漖
aa_get_product_quantities
Extracts the quantities from an Analytics products string.
  • PRODUCTS_STRING: Required The Analytics products string.
aa_get_product_quantities(PRODUCTS_STRING)
aa_get_product_quantities(鈥;Example product 1;1;3.50,Example category 2;Example product 2鈥)
[鈥1鈥, null]
aa_get_product_prices
Extracts the price from an Analytics products string.
  • PRODUCTS_STRING: Required The Analytics products string.
aa_get_product_prices(PRODUCTS_STRING)
aa_get_product_prices(鈥;Example product 1;1;3.50,Example category 2;Example product 2鈥)
[鈥3.50鈥, null]
aa_get_product_event_values
Extracts values for the named event from the products string as an array of strings.
  • PRODUCTS_STRING: Required The Analytics products string.
  • EVENT_NAME: Required The event name to extract values from.
aa_get_product_event_values(PRODUCTS_STRING, EVENT_NAME)
aa_get_product_event_values(鈥;Example product 1;1;4.20;event1=2.3|event2=5:1,;Example product 2;1;4.20;event1=3|event2=2:2鈥, 鈥渆vent1鈥)
[鈥2.3鈥, 鈥3鈥漖
aa_get_product_evars
Extracts the evar values for the named event from the products string as an array of strings.
  • PRODUCTS_STRING: Required The Analytics products string.
  • EVAR_NAME: Required The eVar name to extract.
aa_get_product_evars(PRODUCTS_STRING, EVENT_NAME)
aa_get_product_evars(鈥;Example product;1;6.69;;eVar1=Merchandising value鈥, 鈥渆Var1鈥)
[鈥淢erchandising value鈥漖

Object copy object-copy

TIP
The object copy feature is automatically applied when an object in the source is mapped to an object in the XDM. No additional action needed from users.

You can use the object copy feature to automatically copy attributes of an object without making changes to the mapping. For example, if your source data has a structure of:

address{
        line1: 4191 Ridgebrook Way,
        city: San Jose,
        state: California
        }

and an XDM structure of:

addr{
    addrLine1: 4191 Ridgebrook Way,
    city: San Jose,
    state: California
    }

Then the mapping becomes:

address -> addr
address.line1 -> addr.addrLine1

In the example above, the city and state attributes are also ingested automatically at runtime because the address object is mapped to addr. If you were to create a line2 attribute in the XDM structure and your input data also contains a line2 in the address object, then it will also be automatically ingested without any need to manually alter the mapping.

To ensure that the automatic mapping works, the following prerequisites must be met:

  • Parent-level objects should be mapped;
  • New attributes must have been created in the XDM schema;
  • New attributes should have matching names in the source schema and the XDM schema.

If any of the prerequisites are not met, then you must manually map the source schema to the XDM schema using data prep.

Appendix

The following provides additional information on using Data Prep mapping functions

Special characters special-characters

The table below outlines a list of reserved characters and their corresponding encoded characters.

Reserved character
Encoded character
space
%20
!
%21
"
%22
#
%23
$
%24
%
%25
&
%26
%27
(
%28
)
%29
*
%2A
+
%2B
,
%2C
/
%2F
:
%3A
;
%3B
<
%3C
=
%3D
>
%3E
?
%3F
@
%40
[
%5B
|
%5C
]
%5D
^
%5E
`
%60
~
%7E

Device field values device-field-values

The table below outlines a list of device field values and their corresponding descriptions.

Device
Description
Desktop
A Desktop or a Laptop type of device.
Anonymized
An anonymous device. In some cases, these are useragents that have been altered by an anonymization software.
Unknown
An unknown device. These are usually useragents that contain no information about the device.
Mobile
A mobile device that is yet to be identified. This mobile device can be an eReader, a tablet, a phone, a watch, etc.
Tablet
A mobile device with a large screen (commonly > 7").
Phone
A mobile device with a small screen (commonly < 7").
Watch
A mobile device with a tiny screen (commonly < 2"). These devices normally operate as an additional screen for a phone/tablet type of device.
Augmented Reality
A mobile device with AR capabilities.
Virtual Reality
A mobile device with VR capabilities.
eReader
A device similar to a tablet, but usually with an eInk screen.
Set-top box
A connected device that allows interaction through a TV-sized screen.
TV
A device similar to the Set-top box, but is built into the TV.
Home Appliance
A (usually large) home appliance, like a refrigerator.
Game Console
A fixed gaming system like a Playstation or an XBox.
Handheld Game Console
A mobile gaming system like a Nintendo Switch.
Voice
A voice-driven device like an Amazon Alexa or a Google Home.
Car
A vehicle-based browser.
Robot
Robots that visit a website.
Robot Mobile
Robots that visit a website but indicates that they want to be seen as a Mobile visitor.
Robot Imitator
Robots that visit a website, pretending that are robots like Google, but they are not. Note: In most cases, Robot Imitators are indeed robots.
Cloud
A cloud-based application. These are neither robots nor hackers, but are applications that need to connect. This includes Mastodon servers.
Hacker
This device value is used in case scripting is detected in the useragent string.

Code samples code-samples

map_get_values map-get-values

Select to view example
code language-json
聽example = "map_get_values(book_details,\"author\") where input is : {\n" +
聽 聽 聽 聽 " 聽 聽\"book_details\":\n" +
聽 聽 聽 聽 " 聽 聽{\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"author\": \"George R. R. Martin\",\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"price\": 17.99,\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"ISBN\": \"ISBN-978-0553801477\"\n" +
聽 聽 聽 聽 " 聽 聽}\n" +
聽 聽 聽 聽 "}",
聽 聽 聽 result = "{\"author\": \"George R. R. Martin\"}"

map_has_keys map_has_keys

Select to view example
code language-json
 example = "map_has_keys(book_details,\"author\")where input is : {\n" +
        "    \"book_details\":\n" +
        "    {\n" +
        "        \"author\": \"George R. R. Martin\",\n" +
        "        \"price\": 17.99,\n" +
        "        \"ISBN\": \"ISBN-978-0553801477\"\n" +
        "    }\n" +
        "}",
      result = "true"

add_to_map add_to_map

Select to view example
code language-json
example = "add_to_map(book_details, book_details2) where input is {\n" +
聽 聽 聽 聽 " 聽 聽\"book_details\":\n" +
聽 聽 聽 聽 " 聽 聽{\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"author\": \"George R. R. Martin\",\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"price\": 17.99,\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"ISBN\": \"ISBN-978-0553801477\"\n" +
聽 聽 聽 聽 " 聽 聽}\n" +
聽 聽 聽 聽 "}" +
聽 聽 聽 聽 "{\n" +
聽 聽 聽 聽 " 聽 聽\"book_details2\":\n" +
聽 聽 聽 聽 " 聽 聽{\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"author\": \"Neil Gaiman\",\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"price\": 17.99,\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"ISBN\": \"ISBN-0-380-97365-0\"\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"publisher\": \"William Morrow\"\n" +
聽 聽 聽 聽 " 聽 聽}\n" +
聽 聽 聽 聽 "}",
聽 聽 聽 result = "{\n" +
聽 聽 聽 聽 " 聽 聽\"book_details\":\n" +
聽 聽 聽 聽 " 聽 聽{\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"author\": \"George R. R. Martin\",\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"price\": 17.99,\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"ISBN\": \"ISBN-978-0553801477\"\n" +
聽 聽 聽 聽 " 聽 聽 聽 聽\"publisher\": \"William Morrow\"\n" +
聽 聽 聽 聽 " 聽 聽}\n" +
聽 聽 聽 聽 "}",
聽 聽 聽 returns = "A new map with all elements from map and addends"

object_to_map object_to_map

Syntax 1

Select to view example
code language-json
example = "object_to_map(\"firstName\", \"John\", \"lastName\", \"Doe\")",
result = "{\"firstName\" : \"John\", \"lastName\": \"Doe\"}"

Syntax 2

Select to view example
code language-json
example = "object_to_map(address) where input is " +
  "address: {line1 : \"345 park ave\",line2: \"bldg 2\",City : \"san jose\",State : \"CA\",type: \"office\"}",
result = "{line1 : \"345 park ave\",line2: \"bldg 2\",City : \"san jose\",State : \"CA\",type: \"office\"}"

Syntax 3

Select to view example
code language-json
example = "object_to_map(addresses,type)" +
        "\n" +
        "[\n" +
        "    {\n" +
        "        \"line1\": \"345 park ave\",\n" +
        "        \"line2\": \"bldg 2\",\n" +
        "        \"City\": \"san jose\",\n" +
        "        \"State\": \"CA\",\n" +
        "        \"type\": \"home\"\n" +
        "    },\n" +
        "    {\n" +
        "        \"line1\": \"345 park ave\",\n" +
        "        \"line2\": \"bldg 2\",\n" +
        "        \"City \": \"san jose\",\n" +
        "        \"State\": \"CA\",\n" +
        "        \"type\": \"work\"\n" +
        "    },\n" +
        "    {\n" +
        "        \"line1\": \"345 park ave\",\n" +
        "        \"line2\": \"bldg 2\",\n" +
        "        \"City \": \"san jose\",\n" +
        "        \"State\": \"CA\",\n" +
        "        \"type\": \"office\"\n" +
        "    }\n" +
        "]" ,
result = "{\n" +
        "    \"home\":\n" +
        "    {\n" +
        "        \"line1\": \"345 park ave\",\n" +
        "        \"line2\": \"bldg 2\",\n" +
        "        \"City\": \"san jose\",\n" +
        "        \"State\": \"CA\",\n" +
        "        \"type\": \"home\"\n" +
        "    },\n" +
        "    \"work\":\n" +
        "    {\n" +
        "        \"line1\": \"345 park ave\",\n" +
        "        \"line2\": \"bldg 2\",\n" +
        "        \"City \": \"san jose\",\n" +
        "        \"State\": \"CA\",\n" +
        "        \"type\": \"work\"\n" +
        "    },\n" +
        "    \"office\":\n" +
        "    {\n" +
        "        \"line1\": \"345 park ave\",\n" +
        "        \"line2\": \"bldg 2\",\n" +
        "        \"City \": \"san jose\",\n" +
        "        \"State\": \"CA\",\n" +
        "        \"type\": \"office\"\n" +
        "    }\n" +
        "}"

array_to_map array_to_map

Select to view example
code language-json
example = "array_to_map(addresses, \"type\") where addresses is\n" +
  "\n" +
  "[\n" +
  "    {\n" +
  "        \"line1\": \"345 park ave\",\n" +
  "        \"line2\": \"bldg 2\",\n" +
  "        \"City\": \"san jose\",\n" +
  "        \"State\": \"CA\",\n" +
  "        \"type\": \"home\"\n" +
  "    },\n" +
  "    {\n" +
  "        \"line1\": \"345 park ave\",\n" +
  "        \"line2\": \"bldg 2\",\n" +
  "        \"City \": \"san jose\",\n" +
  "        \"State\": \"CA\",\n" +
  "        \"type\": \"work\"\n" +
  "    },\n" +
  "    {\n" +
  "        \"line1\": \"345 park ave\",\n" +
  "        \"line2\": \"bldg 2\",\n" +
  "        \"City \": \"san jose\",\n" +
  "        \"State\": \"CA\",\n" +
  "        \"type\": \"office\"\n" +
  "    }\n" +
  "]" ,
result = "{\n" +
  "    \"home\":\n" +
  "    {\n" +
  "        \"line1\": \"345 park ave\",\n" +
  "        \"line2\": \"bldg 2\",\n" +
  "        \"City\": \"san jose\",\n" +
  "        \"State\": \"CA\",\n" +
  "        \"type\": \"home\"\n" +
  "    },\n" +
  "    \"work\":\n" +
  "    {\n" +
  "        \"line1\": \"345 park ave\",\n" +
  "        \"line2\": \"bldg 2\",\n" +
  "        \"City \": \"san jose\",\n" +
  "        \"State\": \"CA\",\n" +
  "        \"type\": \"work\"\n" +
  "    },\n" +
  "    \"office\":\n" +
  "    {\n" +
  "        \"line1\": \"345 park ave\",\n" +
  "        \"line2\": \"bldg 2\",\n" +
  "        \"City \": \"san jose\",\n" +
  "        \"State\": \"CA\",\n" +
  "        \"type\": \"office\"\n" +
  "    }\n" +
  "}",
returns = "Returns a map with given field name and value pairs or null if input is null"
recommendation-more-help
461cc884-c234-4a0c-ac75-6efbaafc1394