Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
Anatoly Smolyaninov edited this page May 31, 2019 · 4 revisions

The MAP Function

Function Group: Collection

MAP applies a function to every element in a collection and returns an array.

Syntax

MAP(arg1, arg2)

  • arg1 is the function (see FN) to apply to the collection
  • arg2 is a collection

Uses

Let's say we're given a response with some vehicle information that looks like this:

{  
   "data":{  
      "fleet_prices":[16000, 17450, 9200],
      "fleet_names": ["bmw", "audi", "mercedes benz"]
    }
}

If we want all of the values in fleet_names to be capitalized, we can use MAP:

MAP(FN(name, UPPER(name & 'foo')), data.fleet_names)

This would return ["BMW, "AUDI", "MERCEDES BENZ"].

Clone this wiki locally