List of functions
The following tables list all supported mapping functions, including sample expressions and their resulting outputs.
String functions
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
concat | Concatenates the given strings. |
| concat(STRING_1, STRING_2) | concat("Hi, ", “there”, “!”) | "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. |
| explode(STRING, REGEX) | explode(“Hi, there!”, " ") | ["Hi,", "there"] |
instr | Returns the location/index of a substring. |
| instr(INPUT, SUBSTRING, START_POSITION, OCCURRENCE) | instr(“adobe.com”, “com”) | 6 |
replacestr | Replaces the search string if present in original string. |
| replacestr(INPUT, TO_FIND, TO_REPLACE) | replacestr(“This is a string re test”, “re”, “replace”) | “This is a string replace test” |
substr | Returns a substring of a given length. |
| substr(INPUT, START_INDEX, LENGTH) | substr(“This is a substring test”, 7, 8) | " a subst" |
lower / lcase | Converts a string to lowercase. |
| lower(INPUT) | lower(“HeLLo”) lcase(“HeLLo”) | “hello” |
upper / ucase | Converts a string to uppercase. |
| upper(INPUT) | upper(“HeLLo”) ucase(“HeLLo”) | “HELLO” |
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 “explode” function instead. |
| split(INPUT, SEPARATOR) | split(“Hello world”, " ") | ["Hello", "world"] |
join | Joins a list of objects using the separator. |
| join(SEPARATOR, [OBJECTS]) | join(" ", to_array(true, "Hello", "world")) | “Hello world” |
lpad | Pads the left side of a string with the other given string. |
| lpad(INPUT, COUNT, PADDING) | lpad(“bat”, 8, “yz”) | “yzyzybat” |
rpad | Pads the right side of a string with the other given string. |
| rpad(INPUT, COUNT, PADDING) | rpad(“bat”, 8, “yz”) | “batyzyzy” |
left | Gets the first “n” characters of the given string. |
| left(STRING, COUNT) | left(“abcde”, 2) | “ab” |
right | Gets the last “n” characters of the given string. |
| right(STRING, COUNT) | right(“abcde”, 2) | “de” |
ltrim | Removes the whitespace from the beginning of the string. |
| ltrim(STRING) | ltrim(" hello") | “hello” |
rtrim | Removes the whitespace from the end of the string. |
| rtrim(STRING) | rtrim("hello ") | “hello” |
trim | Removes the whitespace from the beginning and the end of the string. |
| trim(STRING) | trim(" hello ") | “hello” |
equals | Compares two strings to confirm if they are equal. This function is case sensitive. |
| STRING1.equals(STRING2) | “string1”.equals(“STRING1”) | false |
equalsIgnoreCase | Compares two strings to confirm if they are equal. This function is not case sensitive. |
| STRING1.equalsIgnoreCase(STRING2) | “string1”.equalsIgnoreCase("STRING1) | true |
Regular expression functions
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
extract_regex | Extracts groups from the input string, based on a regular expression. |
| extract_regex(STRING, REGEX) | extract_regex("E259,E259B_009,1_1", “([,]+),[,]*,([^,]+)”) | [“E259,E259B_009,1_1”, “E259”, “1_1”] |
matches_regex | Checks to see if the string matches against the inputted regular expression. |
| matches_regex(STRING, REGEX) | matches_regex(“E259,E259B_009,1_1”, “([,]+),[,]*,([^,]+)”) | true |
Hashing functions
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
sha1 | Takes an input and produces a hash value using Secure Hash Algorithm 1 (SHA-1). |
| sha1(INPUT, CHARSET) | sha1(“my text”, “UTF-8”) | c3599c11e47719df18a2448690840c5dfcce3c80 |
sha256 | Takes an input and produces a hash value using Secure Hash Algorithm 256 (SHA-256). |
| sha256(INPUT, CHARSET) | sha256(“my text”, “UTF-8”) | 7330d2b39ca35eaf4cb95fc846c21ee6a39af698154a83a586ee270a0d372104 |
sha512 | Takes an input and produces a hash value using Secure Hash Algorithm 512 (SHA-512). |
| sha512(INPUT, CHARSET) | sha512(“my text”, “UTF-8”) | a3d7e45a0d9be5fd4e4b9a3b8c9c2163c21ef708bf11b4232bb21d2a8704ada2cdcd7b367dd0788a89a5c908cfe377aceb1072a7b386b7d4fd2ff68a8fd24d16 |
md5 | Takes an input and produces a hash value using MD5. |
| md5(INPUT, CHARSET) | md5(“my text”, “UTF-8”) | d3b96ce8c9fb4e9bd0198d03ba6852c7 |
crc32 | Takes an input uses a cyclic redundancy check (CRC) algorithm to produce a 32-bit cyclic code. |
| crc32(INPUT, CHARSET) | crc32(“my text”, “UTF-8”) | 8df92e80 |
URL functions
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. |
| get_url_protocol(URL) | get_url_protocol(“https://platform.adobe.com/home”) | https |
get_url_host | Returns the host of the given URL. If the input is invalid, it returns null. |
| get_url_host(URL) | get_url_host(“https://platform.adobe.com/home”) | platform.adobe.com |
get_url_port | Returns the port of the given URL. If the input is invalid, it returns null. |
| get_url_port(URL) | get_url_port(“sftp://example.com//home/joe/employee.csv”) | 22 |
get_url_path | Returns the path of the given URL. By default, the full path is returned. |
| get_url_path(URL, FULL_PATH) | get_url_path(“sftp://example.com//home/joe/employee.csv”) | “//home/joe/employee.csv” |
get_url_query_str | Returns the query string of a given URL as a map of query string name and query string value. |
| get_url_query_str(URL, ANCHOR) | get_url_query_str(“foo://example.com:8042/over/there?name=ferret#nose”, “retain”) get_url_query_str(“foo://example.com:8042/over/there?name=ferret#nose”, “remove”) get_url_query_str(“foo://example.com:8042/over/there?name=ferret#nose”, “append”) | {"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. |
| get_url_encoded(URL) | get_url_encoded(“https://example.com/partneralliance_asia-pacific_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. |
| get_url_decoded(URL) | get_url_decoded(“https%3A%2F%2Fexample.com%2Fpartneralliance_asia-pacific_2022”) | https://example.com/partneralliance_asia-pacific_2022 |
Date and time functions
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. |
| 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. |
| 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(DATE, FORMAT, DEFAULT_DATE) | date(“2019-10-23 11:24”, “yyyy-MM-dd HH:mm”, now()) | 2019-10-23T11:24:00Z |
date | Converts a date string into a ZonedDateTime object (ISO 8601 format). |
| date(DATE, FORMAT) | date(“2019-10-23 11:24”, “yyyy-MM-dd HH:mm”) | 2019-10-23T11:24:00Z |
date | Converts a date string into a ZonedDateTime object (ISO 8601 format). |
| date(DATE) | date(“2019-10-23 11:24”) | “2019-10-23T11:24:00Z” |
date_part | Retrieves the parts of the date. The following component values are supported: “year” “yyyy” “yy” “quarter” “qq” “q” “month” “mm” “m” “dayofyear” “dy” “y” “day” “dd” “d” “week” “ww” “w” “weekday” “dw” “w” “hour” “hh” “hh24” “hh12” “minute” “mi” “n” “second” “ss” “s” “millisecond” “SSS” |
| date_part(COMPONENT, DATE) | date_part(“MM”, date(“2019-10-17 11:55:12”)) | 10 |
set_date_part | Replaces a component in a given date. The following components are accepted: “year” “yyyy” “yy” “month” “mm” “m” “day” “dd” “d” “hour” “hh” “minute” “mi” “n” “second” “ss” “s” |
| set_date_part(COMPONENT, VALUE, DATE) | set_date_part(“m”, 4, date(“2016-11-09T11:44:44.797”) | “2016-04-09T11:44:44Z” |
make_date_time | Creates a date from parts. This function can also be induced using make_timestamp. |
| make_date_time(YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, NANOSECOND, TIMEZONE) | make_date_time(2019, 10, 17, 11, 55, 12, 999, “America/Los_Angeles”) | 2019-10-17T11:55:12Z |
zone_date_to_utc | Converts a date in any timezone to a date in UTC. |
| zone_date_to_utc(DATE) | 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. |
| zone_date_to_zone(DATE, ZONE) | zone_date_to_zone(now(), "Europe/Paris") | 2021-10-26T15:43:59Z |
Hierarchies - Objects
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
is_empty | Checks whether or not an object is empty. |
| is_empty(INPUT) | is_empty([1, null, 2, 3]) | false |
arrays_to_object | Creates a list of objects. |
| 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. |
| to_object(INPUT) | to_object(“firstName”, “John”, “lastName”, “Doe”) | {"firstName": "John", "lastName": "Doe"} |
str_to_object | Creates an object from the input string. |
| 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. |
|
|
contains_key | Checks if the object exists within the source data. Note: This function replaces the deprecated is_set() function. |
| contains_key(INPUT) | contains_key(“evars.evar.field1”) | 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. |
| get_keys(OBJECT) | get_keys({“book1”: “Pride and Prejudice”, “book2”: “1984”}) | ["book1", "book2"] |
get_values | Parses the key/value pairs and returns the value of the string, based on the given key. |
| 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. |
| 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_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. |
| 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_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_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
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
coalesce | Returns the first non-null object in a given array. |
| coalesce(INPUT) | coalesce(null, null, null, “first”, null, “second”) | “first” |
first | Retrieves the first element of the given array. |
| first(INPUT) | first(“1”, “2”, “3”) | “1” |
last | Retrieves the last element of the given array. |
| last(INPUT) | last(“1”, “2”, “3”) | “3” |
add_to_array | Adds elements to the end of the array. |
| add_to_array(ARRAY, VALUES) | add_to_array([‘a’, ‘b’], ‘c’, ‘d’) | [‘a’, ‘b’, ‘c’, ‘d’] |
join_arrays | Combines the arrays with each other. |
| join_arrays(ARRAY, VALUES) | join_arrays([‘a’, ‘b’], [‘c’], [‘d’, ‘e’]) | [‘a’, ‘b’, ‘c’, ‘d’, ‘e’] |
to_array | Takes a list of inputs and converts it 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. |
| 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. |
| 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. |
| upsert_array_replace(ARRAY) | upsert_array_replace([123, 456], 1) | [123, 456] |
Destinations only 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. |
| array_to_string(SEPARATOR, ARRAY) | array_to_string(";", ["Hello", "world"]) | “Hello;world” |
Destinations only filterArray* | Filters the given array based on a predicate. Note: This function is used in destinations. Read the documentation for more information. |
| filterArray(ARRAY, PREDICATE) | filterArray([5, -6, 0, 7], x -> x > 0) | [5, 7] |
Destinations only transformArray* | Transforms the given array based on a predicate. Note: This function is used in destinations. Read the documentation for more information. |
| transformArray(ARRAY, PREDICATE) | transformArray([5, 6, 7], x -> x + 1) | [6, 7, 8] |
Destinations only flattenArray* | Flattens the given (multidimensional) array to a unidimensional array. Note: This function is used in destinations. Read the documentation for more information. |
| flattenArray(ARRAY) | flattenArray([[[‘a’, ‘b’], [‘c’, ‘d’]], [[‘e’], [‘f’]]]) | [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’] |
Hierarchies - Map
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’s field with the value as key and the array element 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. |
| object_to_map(OBJECT_INPUT) | "object_to_map(address) where input is " + “address: {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) | “to_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
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. |
| decode(KEY, OPTIONS) | decode(stateCode, “ca”, “California”, “pa”, “Pennsylvania”, “N/A”) | If the stateCode given is “ca”, “California”. If the stateCode given is “pa”, “Pennsylvania”. If the stateCode doesn’t match the following, “N/A”. |
iif | Evaluates a given boolean expression and returns the specified value based on the result. |
| iif(EXPRESSION, TRUE_VALUE, FALSE_VALUE) | iif(“s”.equalsIgnoreCase(“S”), “True”, “False”) | “True” |
Aggregation
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
min | Returns the minimum of the given arguments. Uses natural ordering. |
| min(OPTIONS) | min(3, 1, 4) | 1 |
max | Returns the maximum of the given arguments. Uses natural ordering. |
| max(OPTIONS) | max(3, 1, 4) | 4 |
Type conversions
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
to_bigint | Converts a string to a BigInteger. |
| to_bigint(STRING) | to_bigint(“1000000.34”) | 1000000.34 |
to_decimal | Converts a string to a Double. |
| to_decimal(STRING) | to_decimal(“20.5”) | 20.5 |
to_float | Converts a string to a Float. |
| to_float(STRING) | to_float(“12.3456”) | 12.34566 |
to_integer | Converts a string to an Integer. |
| to_integer(STRING) | to_integer(“12”) | 12 |
JSON functions
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
json_to_object | Deserialize JSON content from the given string. |
| json_to_object(STRING) | json_to_object({“info”:{“firstName”:“John”,“lastName”: “Doe”}}) | An object representing the JSON. |
Special operations
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 Adobe Experience Platform and Adobe Experience Cloud applications. |
| fpid_to_ecid(STRING) | fpid_to_ecid("4ed70bee-b654-420a-a3fd-b58b6b65e991") | "28880788470263023831040523038280731744" |
User agent functions
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.
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
ua_os_name | Extracts the operating system name from the user agent string. |
| ua_os_name(USER_AGENT) | ua_os_name(“Mozilla/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’s major version from the user agent string. |
| ua_os_version_major(USER_AGENT) | ua_os_version_majors(“Mozilla/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’s version from the user agent string. |
| ua_os_version(USER_AGENT) | ua_os_version(“Mozilla/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’s name and version from the user agent string. |
| ua_os_name_version(USER_AGENT) | ua_os_name_version(“Mozilla/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. |
| ua_agent_version(USER_AGENT) | ua_agent_version(“Mozilla/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. |
| ua_agent_version_major(USER_AGENT) | ua_agent_version_major(“Mozilla/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. |
| ua_agent_name(USER_AGENT) | ua_agent_name(“Mozilla/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. |
| ua_device_class(USER_AGENT) | ua_device_class(“Mozilla/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
Function | Description | Parameters | Syntax | Expression | Sample output |
---|---|---|---|---|---|
aa_get_event_id | Extracts the event ID from an Analytics event string. |
| aa_get_event_id(EVENT_STRING, EVENT_NAME) | aa_get_event_id(“event101=5:123456,scOpen”, “event101”) | 123456 |
aa_get_event_value | Extracts the event value from an Analytics event string. If the event value is not specified 1 is returned. |
| aa_get_event_value(EVENT_STRING, EVENT_NAME) | aa_get_event_value(“event101=5:123456,scOpen”, “event101”) | 5 |
aa_get_product_categories | Extracts the product category from an 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,“Example category 2”] |
aa_get_product_names | Extracts the product name from an 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”) | [“Example product 1”,“Example product 2”] |
aa_get_product_quantities | Extracts the quantities from an 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. |
| 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. |
| 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”, “event1”) | [“2.3”, “3”] |
aa_get_product_evars | Extracts the evar values for the named event from the products string as an array of strings. |
| aa_get_product_evars(PRODUCTS_STRING, EVENT_NAME) | aa_get_product_evars(“;Example product;1;6.69;;eVar1=Merchandising value”, “eVar1”) | [“Merchandising value”] |
Object copy
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
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
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
map_get_values
Select to view example
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
Select to view example
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
Select to view example
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
Syntax 1
Select to view example
example = "object_to_map(\"firstName\", \"John\", \"lastName\", \"Doe\")",
result = "{\"firstName\" : \"John\", \"lastName\": \"Doe\"}"
Syntax 2
Select to view example
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
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
Select to view example
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"
More help on this topic
Top Tips to Maximize Value with Adobe Experience Platform Data Distiller
Explore best practices for maximizing the value of Data Distiller, a powerful tool that transforms and enriches data in Adobe Experience...
Wed, Mar 19, 3:30 PM PDT (10:30 PM UTC)
Elevate and Empower Teams with Agentic AI for Exceptional Experiences
Elevate and empower your CX teams with AI that transforms creativity, personalization, and productivity. Discover how Adobe is...
Tue, Mar 18, 1:00 PM PDT (8:00 PM UTC)
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more