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
MAX
Dan Gorman edited this page Nov 29, 2018
·
2 revisions
MAX
returns the largest value in a numeric dataset.
MAX(arg1, [arg2...])
-
arg1
can be a number, string or an array of numbers or strings (or anything that can be coerced into being a number) -
arg2
is optional, and has the same restrictions asarg1
-
MAX
also takes an arbitrary number of additional arguments
Let's say we're given a response with some service station information that looks like this:
{
"data":{
"local_service_ratings": {
"cheapest": 4,
"nearest": 6,
"regional": [4, 5, 6, 8, 9]
}
}
}
If we want to find highest rated service stations, we can just use MAX
:
MAX(data.local_service_ratings.cheapest, data.local_service_ratings.nearest)
This will return 6
.
MAX
can also take arrays as arguments.
MAX(data.local_service_ratings.cheapest, data.local_service_ratings.nearest, data.local_service_ratings.regional) => 9