The following are the array functions typically used in Alaya Connector.
add (array; value1; value2; ...)
This function adds values specified in parameters to an array, and returns that array.
contains (array; value)
This function verifies if an array contains the value.
distinct (array; [key])
This function removes duplicates inside an array. The "use" argument offers access to properties inside complex objects. To access nested properties, use the 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.
flatten (array)
This function creates a new array with all sub-array elements concatenated into it and recursively up to the specified depth.
We will provide more instructional articles to this function in the future.
join (array; separator)
This function concatenates all items of an array into a string and uses a specified separator between each item.
keys (object)
This function returns an array of a given object's or array's properties.
length (array)
This function returns the number of items in an array.
map (complex array; key;[key for filtering];[possible values for filtering separated by a comma])
This function returns a primitive array containing values of a complex array. Filtering values are allowed, and this function uses 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.
merge (array1; array2; ...)
This function merges two or more arrays into one array.
remove (array; value1; value2; ...)
This function removes values specified in the parameters of an array. Effective only in case of primitive arrays of text or numbers.
reverse (array)
The function reverses the first element of the array into the last element, and vice versa.
slice (array; start; [end])
This function returns a new array containing only selected items.
sort (array; [order]; [key])
This function 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.
This function uses the key
parameter to access properties inside complex objects and uses raw variable names for keys. To access nested properties, use the dot notation instead. 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.
Comments
0 comments
Article is closed for comments.