Manipulate arrays and maps efficiently in Vadalog programs.

Array Operations

collections:size()

Get the number of elements in an array:

collections:is_empty()

Check if an array is empty:

collections:contains()

Check if an array contains a specific value:

collections:contains_all()

Check if an array contains all elements from another array:

collections:add()

Add an element to an array:

collections:remove()

Remove all occurrences of a value from an array:

collections:get()

Get an element at a specific index (1-based):

Set Operations on Arrays

collections:union()

Combine two arrays, removing duplicates:

collections:difference()

Get elements in first array but not in second:

collections:intersection()

Get common elements between two arrays:

Array Transformations

collections:sort()

Sort array elements in ascending or descending order:
The optional second parameter specifies the sort order:
  • "asc" - Sort in ascending order (default)
  • "desc" - Sort in descending order

collections:distinct()

Remove duplicate elements from array:

collections:remove_nulls()

Remove all null values from array:

collections:shuffle()

Randomly shuffle array elements:

Advanced Array Operations

collections:explode()

Expand array into multiple rows (one per element):

collections:flatten()

Transforms an array of arrays into a single array:

collections:slice()

Extract a slice of an array:

collections:sub_array()

Get first N elements from array:

collections:transform()

Apply a transformation function to each element:

collections:filter()

Filter array elements based on a condition:

Map Operations

collections:map()

Create a map from key-value pairs: