1. Docs
  2. Formulas
  3. Functions

FIND

Returns the first element in the array for which the lambda returns true.

Categories: Lambdas, Arrays

Syntax

FIND(array, LAMBDA(item, [expr]))

Examples

Example 1

Input

1
{
2
"my_array": [
3
{
4
"animal": "bee",
5
"type": "insect"
6
},
7
{
8
"animal": "cat",
9
"type": "mammal"
10
},
11
{
12
"animal": "dog",
13
"type": "mammal"
14
}
15
]
16
}

Formula

FIND(my_array, LAMBDA(item, item.type = 'mammal'))

Output

1
{
2
"animal": "cat",
3
"type": "mammal"
4
}

Example 2

Input

1
{
2
"my_array": [
3
{
4
"animal": "bee",
5
"type": "insect"
6
},
7
{
8
"animal": "cat",
9
"type": "mammal"
10
},
11
{
12
"animal": "dog",
13
"type": "mammal"
14
}
15
]
16
}

Formula

FIND(my_array, LAMBDA(item, item.type = 'fish'))

Output

null

Sample actions

Event Transform
My Action
Event Transform
FIND

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?