Filter List by Non-Matches | ARRAY_MATCH

Syntax

ARRAY_MATCH( [value], [filter] )

Parameters

value
An array to filter.

filter
A MAP or a function BLOCK to filter the items. If a MAP is used, non-matched values are filtered out. If a BLOCK is used, values that return FALSE are filtered out.

Return Value

Returns an array with all items in the VALUE don not match the FILTER removed.

Description

Remove items not matching a filter from an ARRAY.

Examples

ARRAY_MATCH([], MAP()) # returns []
# VALUE is [["a" => 1, "b" => 2], ["a" => 3, "b" => 4], ["a"=> 1, "b" => 5]]
ARRAY_MATCH(VALUE, ["a" => 1]) # returns [["a" => 1, "b" => 2], ["a"=> 1, "b" => 5]]
# VALUE is [["a" => 1, "b" => 2], ["a" => 3, "b" => 4], ["a"=> 1, "b" => 5]]
ARRAY_MATCH(VALUE, ["a" => 1, "b" => 2]) # returns [["a" => 1, "b" => 2]]
# VALUE is [["a" => 1, "b" => 2], ["a" => 3, "b" => 4], ["a"=> 1, "b" => 5]]
ARRAY_MATCH(VALUE, {|item| MAP_GET(${item}, "a") == 1}) # returns [["a" => 1, "b" => 2], ["a"=> 1, "b" => 5]]
ARRAY_MATCH(null, ["a" => 1]) # returns []
# VALUE is [["a" => 1, "b" => 2], ["a" => 3, "b" => 4], ["a"=> 1, "b" => 5]]
ARRAY_MATCH(VALUE, CURRENT_DATE()) # returns []