Powered By GitBook
SELECT_BY_KEY
Find objects from a list by a key

Description

Finds multiple objects from the given list by a key-value pair.
For example, given Key "age" and Value 20, will return a list containing all objects in the list whose age property is 20, or an empty list if no matching objects were found.

Function signature

1
SELECT_BY_KEY(list: Array, key: String, value: ) => Array
Copied!
Parameter
Description
List
List to find objects in
Key
Key whose value to match
Value
Value to match

Examples

1
array1 = [{"a":3},{"a":2},{"a":2,"b":3}]
2
array2 = [{"a":3},{"a":{"b":10}}]
3
array = [{"a":3},{"a":2}]
Copied!
Formula
Return value
SELECT_BY_KEY(array1, "a", 2)
[{"a":2},{"a":2,"b":3}]
SELECT_BY_KEY(array2, "a", { b: 10 })
[{"a":{"b":10}}]
SELECT_BY_KEY(array, "a", 4)
[]
Last modified 11mo ago
Export as PDF
Copy link