LAMBDA

Creates a custom, reusable function.

The last argument is the calculation you want to perform, all previous arguments are the parameters for this calculation

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 

Transform
My Action
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.

Transform
My Action
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?