Powered By GitBook
EXCLUDE_BY_KEY
Remove objects from a list by a key

Description

Removes objects from a list by a given key-value pair.
Returns a new list which doesn't contain the matched objects, i.e. ones whose Key property's value matches Value.
For example, given Key "id" and Value 0, all objects in the source List whose id property is 0 would be removed from the returned list.

Function signature

1
EXCLUDE_BY_KEY(list: Array, key: String, value: ) => Array
Copied!
Parameter
Description
List
List to exclude objects from
Key
Key whose value to match
Value
Value to match

Examples

1
array1 = [{"a":3},{"a":2},{"a":4,"b":3},{"a":2,"b":5}]
2
key1 = "a"
3
value1 = 2
4
array2 = [{"a":3},{"a":{"b":10}}]
5
key2 = "a"
6
value2 = {"b":10}
Copied!
Formula
Return value
EXCLUDE_BY_KEY(array1, key1, value1)
[{"a":3},{"a":4,"b":3}]
EXCLUDE_BY_KEY(array2, key2, value2)
[{"a":3}]
Last modified 11mo ago
Export as PDF
Copy link