Array Handlers

Array Handlers in Studio are predefined functions used to search, sort, filter, transform, and manipulate arrays (lists) of items during the mapping process.

Using Array Handlers in Mapping

Array handlers can be selected directly inside flow mapping operations. Click any destination field in the mapping panel, open the handler picker, and choose the array function you need — the handler runs inline as part of the mapping step without requiring a separate logic processor.

Accessing Array Handlers

1

Click on any destination field in the mapping panel

2

A pop-up window opens titled "FUNCTION FOR WORKING WITH AN ARRAY"

3

You'll see two sections:

  • Handlers — Available array functions
  • Keywords — Sort keywords (Asc, Desc)
Array Handler Window

Available Array Handlers

append()

append(array1; array2)

Combines multiple arrays into one.

Example

append(["123", "456", "789"]; ["234", "567", "890"])

// Output
["123", "456", "789", "234", "567", "890"]

contains()

contains(array; value)

Checks whether a specified value exists within an array. Returns true if found, false otherwise. For objects, the element must match exactly (same structure and values).

Example

contains(["apple", "banana", "orange"]; "banana") = true

deduplicate()

deduplicate(array)

Removes duplicates from an array. For objects, duplicates are removed only when the objects are fully identical (same keys, same values, same structure).

Example

deduplicate([1, 2, 2, 3, 1, 4]) = [1, 2, 3, 4]

distinct()

distinct(array; [key])

Returns a new array of objects with duplicates removed based on the specified property key. Only supported for arrays of objects.

  • array — The source array of objects
  • key — The property to use for comparison

Example

// Input
[{ "id": 1, "name": "Alice" }, { "id": 2, "name": "Bob" }, { "id": 1, "name": "Alice" }]

distinct(array; "id")

// Output
[{ "id": 1, "name": "Alice" }, { "id": 2, "name": "Bob" }]

first()

first(array)

Retrieves the first element from an array. Works with arrays of simple values (strings, numbers) or objects.

Example

first(["email1@example.com", "email2@example.com", "email3@example.com"])

// Output
"email1@example.com"

last()

last(array)

Returns the last element of the specified array. Works with arrays of integers, strings, and objects.

Example

last(["email1@example.com", "email2@example.com", "email3@example.com"])

// Output
"email3@example.com"

length()

length(array)

Returns the number of items in an array. Works with arrays of integers, strings, and objects.

Example

length(["apple", "banana", "orange"]) = 3

map()

map(complex array; key; [key for filtering]; [possible values for filtering])

Extracts specific values from each element in an array. Can optionally filter results by another field.

  • complex array — Your array, e.g. Items[]
  • key — Which field to extract, e.g. product_id
  • [key for filtering] (optional) — Another field to filter by
  • [possible values for filtering] (optional) — Which values of the filter key to include

Example — Extract a field from all items

map(item[]; item[].product_id)

// Output
["123", "456", "789"]

Example — Extract with filter (quantity = 4)

map(item[]; item[].price; item[].quantity; 4)

// Output: prices of items where quantity = 4
[10]

flatten()

flatten(array)

Takes a multi-dimensional array (an array of arrays) and collapses it into a single one-dimensional array.

Example

// Input
[["tag1", "tag2"], ["tag3", "tag4"], ["tag5"]]

flatten(array)

// Output
["tag1", "tag2", "tag3", "tag4", "tag5"]

join()

join(array; delimiter)

Concatenates the elements of an array into a single string, inserting the given delimiter between each element. Works with arrays of strings or values that can be converted to text.

Example

join(["Product A", "Product B", "Product C"]; ", ")

// Output
"Product A, Product B, Product C"

keys()

keys(object)

Returns an array of a given object's property names (keys).

Example

// Input object
{ "name": "John", "age": 30, "city": "New York" }

keys(user)

// Output
["name", "age", "city"]

sort()

sort(array; [order]; [key])

Orders the elements of an array in ascending or descending order. Works with arrays of integers, strings, and objects.

  • array — The source array
  • order"asc" (A→Z / 0→9) or "desc" (Z→A / 9→0)
  • key (optional) — The field to sort by when sorting an array of objects

Example — Simple array

sort([5, 2, 8, 1, 4]; "desc")

// Output
[8, 5, 4, 2, 1]

Example — Array of objects

sort(Contacts[]; "asc"; Contacts[].name)

// Sorts contacts alphabetically by name

toArray()

toArray(object)

Converts an object into an array of key-value pairs.

Example

// Input
{ "name": "Leena", "city": "Riyadh", "active": true }

toArray(Customer)

// Output
[{ "key": "name", "value": "Leena" }, { "key": "city", "value": "Riyadh" }, { "key": "active", "value": true }]

loopOverItems()

loopOverItems(array)

Processes each item within a list or array, mapping from source to destination so that all items are handled during flow execution. Standard mapping only picks up the first item — loopOverItems iterates through every element.

✕ Without loopOverItems
ORD-001 → processed
ORD-002 → ignored
ORD-003 → ignored
Only 1 processed → data loss
✓ With loopOverItems
ORD-001 → processed
ORD-002 → processed
ORD-003 → processed
100% processed → complete
Important: The destination field must support an array to correctly receive the output from the loopOverItems handler.

Related Topics