PLUCK
Get a property of each object in a list

Description

Gets the values for each object in the given list by the given key, and returns a list with those values, in the corresponding order.
For example, if you have a list of people as objects, you can get the name of each person by providing the list as the first parameter, and the key name "name" as the second parameter.

Function signature

1
PLUCK(list: Array, key: String) => Array
Copied!
Parameter
Description
List
List of objects whose properties to get
Key
Name of the key whose value to take from each object

Examples

1
products = [{"name":"Duct tape","price":5},{"name":"Swiss army knife","price":60}]
2
animals = [
3
{
4
"name": "dog",
5
"weight": 123
6
},
7
{
8
"name": "cat",
9
"weight": 48
10
},
11
{
12
"name": "rat",
13
"weight": 10
14
}
15
]
Copied!
Formula
Return value
PLUCK(products, "price")
[5,60]
PLUCK(animals, "name")
["dog","cat","rat"]
Last modified 1yr ago
Export as PDF
Copy link