REDUCE

Allows for turning an array into a single value.

Syntax 

REDUCE(array, LAMBDA(previous_value, current_value, [expr]), initial value)

Examples 

Example 1

Formula

REDUCE(my_array, LAMBDA(previous_value, current_value, PLUS(previous_value, current_value)), 0)

Output

55
Example 2

Formula

REDUCE(array_of_objects, LAMBDA(previous_value, current_value, MERGE(previous_value, current_value)), OBJECT())

Output

{
  "timestamp": "2022-02-15 12:30:00+0000",
  "user": "bob.smith",
  "src_ip": "192.168.1.100",
  "dest_ip": "172.16.1.23",
  "file_hash": "2968896cb4639d4c839ab802720266d35bb15be93e3a4055109aa3bf1779f591",
  "file_name": "executable.exe"
}
Was this helpful?