MAPFILTER

Filters a map for specific items.

There are two variants of this function that work differently

Parameters

OrderNameTypeDesc
1originalmapThe map to be filtered
2filterkeyconstThe name of the map item to be searched for
3filtervalueconstThe value of the map item to allow

or

OrderNameTypeDesc
1originalmapThe map to be filtered
2filterkeymapThe filter

Returns

Places an map on the stack.

Description

This function filters the map (original).

If using the three-parameter version, any item that does not contain the specified filterkey and filtervalue will be removed.

If using the two-parameter version, any item that does not contain each of the map keys and values found in filterkey will be removed.

For example, if you had the following map in your stack…

 [ { "name": "alpha",
     "colour": "orange",
     "style": "plain" },
    { "name": "beta",
      "colour":"blue",
      "style":"exotic"} ]
      

…then the command 'colour' 'blue' MAPFILTER will remove 'alpha' from your map, leaving only 'beta'.

See Also