LAMBDA

Creates a custom, reusable function.

Syntax 

LAMBDA([parameter1, parameter2, …,] calculation)

Usage examples 

Example 1

Select all the elements in an array that regex match the string "r"​

Input

1
{
2
"my_array": [
3
"red",
4
"blue",
5
"green"
6
]
7
}

Formula

FILTER(input.my_array, LAMBDA(element, MATCH(element, "r")))

Output

1
[
2
"red",
3
"green"
4
]

Example 2

Get the difference between 2 arrays, i.e. get elements from array_two that are not present in array_one​

Input

1
{
2
"array_one": [
3
"dog",
4
"cat",
5
"turtle",
6
"dinosaur",
7
"lizard",
8
"chicken",
9
"koala"
10
],
11
"array_two": [
12
"cat",
13
"elephant",
14
"giraffe",
15
"penguin",
16
"tiger",
17
"koala"
18
]
19
}

Formula

FILTER(input.array_two, LAMBDA(array_two_elem, NOT(INCLUDES(input.array_one, array_two_elem))))

Output

1
[
2
"elephant",
3
"giraffe",
4
"penguin",
5
"tiger"
6
]

Sample Actions 

Event Transform
My Action
Event Transform
LAMBDA

Select an Action to inspect.

You can also click "Copy Actions" and paste them in your Tines Story to see how they work.

Event Transform
My Action
Event Transform
LAMBDA

Select an Action to inspect.

You can also click "Copy Actions" and paste them in your Tines Story to see how they work.

Was this helpful?