Explore more
Functions
Array functions
16min
you can use array functions to transform mapping arrays docid\ wohdzddiov0ly51gr9dgy array functions can, for example, search and sort the items in an array, perform mathematical operations, convert arrays to collections, reorder the items in an array, and more below is a list of supported array functions and a description what of each function does add add (array; value1; value2; ) adds values specified in parameters to an array and returns that array contains contains (array; value) verifies if an array contains the value deduplicate deduplicate (array) removes duplicates from an array distinct distinct (array; \[key]) removes duplicates inside an array use the key argument to access properties inside complex objects to access nested properties, use dot notation the first item in an array is index 1 distinct( contacts\[] ; name ) removes duplicates inside an array of contacts by comparing the name property first first (array) returns the first element of an array flatten flatten (array) creates a new array with all sub array elements concatenated into it recursively up to the specified depth more details about this function can be found in the array prototype flat documentation join join (array; separator) concatenates all the items of an array into a string, using a specified separator between each item keys keys (object) returns an array of a given object's or array's properties last last (array) returns the last element of an array length length (array) returns the number of items in an array map map (complex array; key;\[key for filtering];\[possible values for filtering separated by a comma]) returns a primitive array containing values of a complex array allows filtering values use raw variable names for keys map( emails\[] ; email ) returns a primitive array with emails map( emails\[] ; email ; label ; work,home ) returns a primitive array with emails that have a label equal to work or home see also mapping arrays docid\ wohdzddiov0ly51gr9dgy and our extract an item and/or its value from an array of collections https //www youtube com/watch?v=w9cgdteppme video tutorial merge merge (array1; array2; ) merges two or more arrays into one array remove remove (array; value1; value2; ) removes values specified in the parameters of an array effective only in case of primitive arrays of text or numbers reverse reverse (array) the first element of the array becomes the last element and vice versa shuffle shuffle (array) shuffles (randomly reorders) elements of an array slice slice (array; start; \[end]) returns a new array containing only selected items the first item in the array has an index of 0 sort sort (array; \[order]; \[key]) sorts values of an array the valid values of the order parameter are asc (default) ascending order 1, 2, 3, for type number a, b, c, a, b, c, for type text desc descending order , 3, 2, 1 for type number , c, b, a, c, b, a for type text asc ci case insensitive ascending order a, a, b, b, c, c, for type text desc ci case insensitive descending order , c, c, b, b, a, a for type text use the key parameter to access properties inside complex objects use raw variable names for keys to access nested properties, use dot notation the first item in an array is index 1 sort( contacts\[] ; name ) sorts an array of contacts by the name property in default ascending order sort( contacts\[] ; desc ; name ) sorts an array of contacts by the name property in descending order sort( contacts\[] ; asc ci ; name ) sorts an array of contacts by the name property in case insensitive ascending order sort( emails\[] ; sender name ) sorts an array of emails by the sender name property toarray toarray (collection) converts a collection into an array of key value collections tocollection tocollection (array; key; value) converts an array containing objects with key value pairs into a collection