2 min read

Array Operations

Overview

The Array Operations node provides a comprehensive set of in-memory array transformations for workflow data. It operates on upstream arrays without hitting a database — pure JavaScript transforms applied to each row or the full dataset.

Category

Datadata/arrayOps

Operations

OperationDescription
flattenFlatten nested arrays into a single level
uniqueRemove duplicate values from an array
chunkSplit an array into groups of a specified size
compactRemove falsy values (null, undefined, 0, false, '')
zipCombine multiple arrays element-by-element
unzipInverse of zip — split zipped arrays back apart
intersectionReturn elements common to two arrays
differenceReturn elements in array A that are not in array B
unionCombine two arrays, removing duplicates
groupByGroup rows by a field value
sortBySort rows by a field
reverseReverse the order of rows
sliceExtract a portion of the array by index range
sampleReturn a random subset of rows
shuffleRandomize the order of rows
pluckExtract a single field from each row into a flat array

Settings

SettingTypeDefaultDescription
operationStringflattenWhich array operation to perform
fieldStringField name for groupBy, sortBy, pluck
sizeNumber10Chunk size for chunk operation
countNumber1Number of items for sample
startNumber0Start index for slice
endNumberEnd index for slice

Inputs & Outputs

Use Cases

  1. Group orders by status — Use groupBy with field status to bucket orders into pending, shipped, delivered
  2. Deduplicate email lists — Use unique on a plucked email field to remove duplicate addresses
  3. Paginate results — Use slice with start/end to return a specific page of results
  4. Randomize survey questions — Use shuffle to randomize question order