Syntax
REDUCE(array, LAMBDA(previous_value, current_value, [expr]), initial_value)
Usage examples
Example 1
Input | 1 { 2 "my_array": [ 3 1, 4 2, 5 3, 6 4, 7 5, 8 6, 9 7, 10 8, 11 9, 12 10 13 ] 14 } |
Formula | REDUCE(my_array, LAMBDA(previous_value, current_value, PLUS(previous_value, current_value)), 0) |
Output | 55 |
Example 2
Input | 1 { 2 "array_of_objects": [ 3 { 4 "timestamp": "2022-02-15 12:30:00+0000" 5 }, 6 { 7 "user": "bob.smith" 8 }, 9 { 10 "src_ip": "192.168.1.100" 11 }, 12 { 13 "dest_ip": "172.16.1.23" 14 }, 15 { 16 "file_hash": "2968896cb4639d4c839ab802720266d35bb15be93e3a4055109aa3bf1779f591" 17 }, 18 { 19 "file_name": "executable.exe" 20 } 21 ] 22 } |
Formula | REDUCE(array_of_objects, LAMBDA(previous_value, current_value, MERGE(previous_value, current_value)), OBJECT()) |
Output | 1 { 2 "dest_ip": "172.16.1.23", 3 "file_hash": "2968896cb4639d4c839ab802720266d35bb15be93e3a4055109aa3bf1779f591", 4 "file_name": "executable.exe", 5 "src_ip": "192.168.1.100", 6 "timestamp": "2022-02-15 12:30:00+0000", 7 "user": "bob.smith" 8 } |
Sample Actions
Transform
REDUCE
Transform
My Action
Select an action to inspect.
You can also click "Copy actions" and paste them in your Tines story to see how they work.