This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
MAP
Daniel Gorman edited this page May 21, 2019
·
4 revisions
MAP
applies a function to every element in a collection and returns an array.
MAP(arg1, arg2)
-
arg1
is the function to apply to the collection -
arg2
is a collection
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(UPPER(_), data.fleet_names)
This would return ["BMW, "AUDI", "MERCEDES BENZ"]
.